July 30th, 2009, 07:53 PM
My own programming language
Thanks in advance!
July 30th, 2009, 08:09 PM
Can i ask why you want to create your own programming language, instead of using one that already exists?
July 30th, 2009, 08:21 PM
Well, basically I would really like to learn how to make one, I really have a lot of time in my hands. Plus I think that it might be quite useful for specific aplications that may not need certain things.
Originally Posted by MrFujin
July 30th, 2009, 08:41 PM
July 31st, 2009, 03:36 AM
I have no idea what you're asking. You want to compile your programming language into HTML? What does that even mean?
Originally Posted by freetrader0000
August 24th, 2009, 06:11 PM
I was trying to do this thing as a time, then i go to develop an OS written in Assembly, it's good.
August 25th, 2009, 01:51 PM
Compiler design is a fairly large project in and of itself; I would recommend learning about compilers with some subset of an existing language before going ahead with trying anything novel. This is a fairly standard project for an undergrad CS course on compilers (with the grad class being more of the same in more depth); there are several textbooks on the topic, with the Compilers: Principles, Techniques, and Tools being the one used by most courses. In the US at least, most public and university libraries have at least book on the subject.
There are also several online tutorials and pages on the subject floating around, of varying quality. Fortunately, there are several ways of doing this, so even an bad tutorial can be insightful.
You may also want to see the Compiler and Language Wiki, though that seems to be very much a work in progress.
To get you started:
compiling generally has three main stages, Lexical analysis (breaking the source code into a stream of tokens), parsing (processing the token stream for it's grammatical structure), and code generation (the resulting output, whether as an executable file or a source file for a different language). Most compilers use some sort of intermediate stage between the parser and the code generator (to separate the parts specific to the language from the parts specific to the target system, making it easier to re-target the compiler to a different system), and many have some sort of optimizer either between the parser and the code generator, or after the code generator, or both.
To do this right, you should learn something about context-free grammars (and Backus-Naur Form in particular) and Deterministic Finite State Automata, and have a good grasp of the target language (usually some form of assembly language, but in principle it could be any Turing Complete language - rules out markup languages such as HTML).
Adding OS design on top of that... that way madness lies. I of all people know that. Hasn't stopped me from working on and off on it for 15 years, and I doubt it will stop you, either, but I thought I'd at least warn you about the open-ended time sink such a project can become.
This thread describes part of a compiler I wrote for a course I took last year, including an attachment with the compiler source code (in Python) for you to look at, if you'd like. HTH.
EDIT: Fixed the links and markup. sigh This is what I get for rushing to post this before leaving.
Comments on this post
Last edited by Schol-R-LEA; August 27th, 2009 at 11:57 AM.
Reason: Fixed broken links and markup
August 25th, 2009, 03:23 PM
Schol-R-LEA, you can correct your tags, please!
August 25th, 2009, 05:56 PM
Sorry 'bout that, Nathanpc. I've fixed that bad markup, and added some more information and links that I hadn't had time to include the first time through.
August 25th, 2009, 07:13 PM