What language do they build other languages with?

后端 未结 8 974
青春惊慌失措
青春惊慌失措 2021-01-31 09:31

What language is used to build low level languages like c++ and java?

How could you build the first language with no language?

8条回答
  •  清酒与你
    2021-01-31 10:27

    As mentioned by the other posters, you can write a language in practically any language, and often one of the first programs written in a language is a compiler for the language itself.

    However, there are some languages that were specially developed for writing computer languages - namely lex, yacc, flex, bison (updated versions of lex and yacc). These allow you to represent the lexical and grammatical specification of some languages (I believe LLR, or LALR) in a form that can be compiled into an efficient language recognizer.

    You do still have to write other parts of the language compiler/interpreter yourself, i.e. semantic analysis, code generation.

    See

    http://dinosaur.compilertools.net/

提交回复
热议问题