Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a programming language [closed]

Disclaimer: Yes I know this will take 3 years, at least.

I am looking forward to writing a new interpreted programming language. I have a quite solid idea of what I want in terms of dynamicness, syntax, object model, etc, etc.

Now that I have the idea, I have a few questions before I start:

  1. Should I begin writing the full specification and then implement, or write them both all along?
  2. I'm still doubting between C and C++. C++ would allow for more clean design and faster development while C would (maybe) ensure portability to more platforms (microprocessors?). Performance is a must.
  3. Should I try to interest people for the project before the first working prototype so they can cooperate (the end product will be a liberal license anyway), or keep working alone until I have something that runs?
  4. How modular should it be? I am sure that I won't immediately start working on a bytecode interpreter but something easier to implement but slower thing first, so modularity is a must in order to be able to extend later, but I guess overdoing it will hamper performance and clearity.
like image 572
orlp Avatar asked Aug 07 '26 19:08

orlp


2 Answers

The answers to your questions depend largely on why you're doing this- the primary reason. Are you trying to create the next Ruby, or is this a learning exercise?

  1. Specification: If this is a personal project, this is not as important. PHP gets a bad rap for having been developed "on the fly," yet many people use it every day. A more complete spec will probably help get people involved if/when you want help.

  2. If you want cross-platform and performance, C is the way to go.

  3. If you want people to join in, prove something first. Write a killer-cool application with your language and blog/talk about why your language is different/special/better.

  4. Modularity of what, the language itself or the compiler? If you want to extend the language, a good spec will help (see #1.) The compiler should be designed with all the best practices in mind, which should help make it extensible.

I hear the Dragon Book is good for learning to develop compilers.

like image 128
Dave Swersky Avatar answered Aug 10 '26 09:08

Dave Swersky


  1. Your specification will be broken unless you write it hand-in-hand with the implementation.
  2. If you think C++ would give you cleaner design and faster development, you should probably use it.
  3. You will have difficulty getting anyone interested in a project unless there is something that runs and demonstrates what is unique about your language.
  4. If you think your language will ever require a byte-code interpreter (and you do say "Performance is a must") you should investigate the capabilities of existing byte-code interpreters before you finalize your language design.
like image 40
antlersoft Avatar answered Aug 10 '26 10:08

antlersoft



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!