Methodologies for designing a simple programming language

前端 未结 3 1332
温柔的废话
温柔的废话 2021-01-06 02:04

In my ongoing effort to quench my undying thirst for more programming knowledge I have come up with the idea of attempting to write a (at least for now) simple programming l

3条回答
  •  佛祖请我去吃肉
    2021-01-06 02:47

    There are so many ways...

    You could look into stack languages and Forth. It's not very useful when it comes to designing other languages, but it's something that can be done very quickly.

    You could look into functional languages. Most of them are based on a few simple concepts, and have simple parsing. And, yet, they are very powerful.

    And, then, the traditional languages. They are the hardest. You'll need to learn about lexical analysers, parsers, LALR grammars, LL grammars, EBNF and regular languages just to get past the parsing.

    Targeting a bytecode is not just a good idea – doing otherwise is just insane, and mostly useless, in a learning exercise.

    Do yourself a favour, and look up books and tutorials about compilers.

    Either C or Java will do. Java probably has an advantage, as object orientation is a good match for this type of task. My personal recommendation is Scala. It's a good language to do this type of thing, and it will teach you interesting things about language design along the way.

提交回复
热议问题