ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
Hehe... I would code everything in assembly and I would rewrite C with a better syntax and maybe as OO.
Been done, it's called Java *ducks under flame retardant wall*
Quote:
Originally Posted by vargadanis
I dunno if there is any point in creating a new one. There are programming languages for everything now.
There will always be new ideas. This could be for a whole new programming language, or just a new application for an existing one. Look at JRuby. They took an existing, great, pretty new (decade old I think), language, Ruby, and created an interpreter for it on the JVM (they're also trying to create a byte code compiler as well). When MS' .Net became popular, lots of people create .Net compilers for all sorts of languages, like lisp (L# http://www.lsharp.org/).
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.
Funny you should say that, because that is exactly what I am planning to do. I've been trying to find information on basic parsing concepts. I thought I might start out with just a two-word text parser like the old text adventure games and expand from there.
Also, 95se was right on, it is all about learning and having fun. Plus, really improve my programming skills.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.