How to create your own programming language?
If someone wanted to create their own programming language, what steps would need to be taken to do it?
Would you need to know a language like C? It looks like you would need to use LEX & YACC or Flex & Bison? How is the syntax for the language you are creating usually created? Any information on this would be appreciated. I am interested in doing this, but I am a very poor C programmer. So I'm trying to determine what I need to study to reach this goal. Thank you! |
Well, first you need to program. A lot. By that time, the answers to the questions you asked will become evident.
|
Somewhat similar to what tuxdev said..
One could argue that if you have the knowledge to create a *usable* programming knowledge, you also know the answer to your question(s). |
|
It depends on what you want to create. If you want to invent a DSL (domain-specific language) from existing material, you can write a macro-based language on top of an existing PL like LISP. If you want to write a new language from scratch, you'll have to do a lot of research first. Here's some books / papers / links to get started: http://lambda-the-ultimate.org/node/492 (LtU is a great aggregating resource for PL design).
As far as writing compilers go, you can do it in any language, not just C. There are books about writing compilers in C, Java, Standard ML, you name it. Lexer and parser generators exist for many languages, in addition to Lex / Yacc for C. Eventually, some language designers decide to write the compiler of a language in the language itself. :) |
I second 95se's suggestion!
Trizon - if you're genuinely interested in an answer to your question, please beg, borrow or ... well ... just GET a copy of "The Dragon Book". It's absolutely the single best "first step" for understanding "how programming languages work" and how to go about writing your own. IMHO .. PSM |
Thanks guys, I really appreciate the help!
I have heard about the dragon book, but I had no idea what the real name of it was. Thanks for the link! You guys have some great suggestions! It has helped clear up some things. |
|
Hehe... I would code everything in assembly and I would rewrite C with a better syntax and maybe as OO. I dunno if there is any point in creating a new one. There are programming languages for everything now.
|
Quote:
Quote:
Aside from this, it's just fun creating a language, even a small useless one, and seeing it work. Just like everything else. I'm sure many of us have create a text editor. We didn't do it because we were trying to create something new and useful, but just learning and having fun :) |
I also recommend you write a simple text parsing application first and familiarize yourself with the concepts. Rome wasn't built in a day. :p
|
Quote:
Also, 95se was right on, it is all about learning and having fun. Plus, really improve my programming skills. |
Have fun and enjoy. Programming can be a joy when you aren't under pressure to deliver results. It's the process itself rather than the end result.
Good luck. :) |
Quote:
|
Hi.
Languages that are small, little, and mini -- often domain-specific or task-specific -- are discussed in: Programming Pearls, 2nd, Jon Bentley, The Practice of Programming, Kernighan and Pike, The Pragmatic Programmer, Hunt and Thomas Best wishes ... cheers, makyo |
All times are GMT -5. The time now is 02:49 AM. |