🔒 Locked
creating a basic programming language
Advertisement
Original Post
Ok I was looking through some articles and I found some on people making their own programming language. They were basic of course but I found it very interesting so I was wondering where a good place to start would be for me to make my own. All I'd like to do at present is have it display text and variables in the console window. Any hints?
You need at least 2 parts:
1) syntax for your language and some code that reads it into an internal representation (easiest way to cheat around that one is: use a lisp and use (read) to do the job)
2) code that somehow executes the stuff you have read in
The sicp lectures explain some parts of 2) in the later lectures.
1) syntax for your language and some code that reads it into an internal representation (easiest way to cheat around that one is: use a lisp and use (read) to do the job)
2) code that somehow executes the stuff you have read in
The sicp lectures explain some parts of 2) in the later lectures.
I'd recommened this article. Basically, you're going to write your own commands in a text file, and then have your interpreter program parse the file and act on the commands it finds. Building a compiled language is a whole other issue, but there are plenty of books on the subject.
EDIT: Beaten to it...
EDIT: Beaten to it...
This is a link to a great free book on programming language concepts and how to build, design and build a language: Programming Langauge Concepts.
It uses SML and Java and you will learn both how to build a functional language (like SML), an imperative language (like C), and even an object oriented language (like a subset of Jaca/C#).
It's a very good book (I followed the course at university held by the author).
Check it out - and good luck.
It uses SML and Java and you will learn both how to build a functional language (like SML), an imperative language (like C), and even an object oriented language (like a subset of Jaca/C#).
It's a very good book (I followed the course at university held by the author).
Check it out - and good luck.
The Dragon Book. (laugh -- first hit on a google search!)
Aka, Compilers: Principles, Tools and Techniques.
Aka, Compilers: Principles, Tools and Techniques.
you should definitely look at lex and yacc.
If you're interested in going a bit further with it, check out the book Programming Language Pragmatics. It covers quite a bit more than just the simple features you've mentioned, but it's a great text on programming language theory and how programming languages are implemented. Well worth it if you're interested in languages beyond simple interpreted scripts.
Quote:
thanks for that guys I was expecting to have people shut down the idea but yous didnt thank you :D
Heh, a trip of 10,000 miles starts with a single post. Compilers are one of the REALLY interesting problems in computer science that has been worked out for quiet some time. They're a fascinating subject.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement