How to create a language these days?

后端 未结 19 1803
青春惊慌失措
青春惊慌失措 2020-12-28 11:24

I need to get around to writing that programming language I\'ve been meaning to write. How do you kids do it these days? I\'ve been out of the loop for over a decade; are yo

相关标签:
19条回答
  • 2020-12-28 12:13

    Not so much an implementation but a design decision which effects implementation - if you make every statement of your language have a unique parse tree without context, you'll get something that it's easy to hand-code a parser, and that doesn't require large amounts of work to provide syntax highlighting for. Similarly simple things like using a different symbol for module namespaces and object namespaces ( unlike Java which uses . for both package and class namespaces ) means you can parse the code without loading every module that it refers to.

    Standard libraries - include the equivalent of everything in C99 standard libraries other than setjmp. Add whatever else you need for your domain. Work out an easy way to do this, either something like SWIG or an in-line FFI such as Ruby's [can't remember module name] and Python's ctypes.

    Building as much of the language in the language is an option, but projects which start out doing either give up (rubinius moved to using C++ for parts of its standard library), or is only for research purposes (Mozilla Narcissus)

    0 讨论(0)
提交回复
热议问题