What language do they build other languages with?

后端 未结 8 980
青春惊慌失措
青春惊慌失措 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:29

    Typically another machine or another language is used to write the first assembler and the first compiler.

    As long as a working computer and a working language is available, even if rather different, the problem can be solved in two steps.

    1. Write target language x for computer y in language z on computer (urk) a.

    2. Write target language x for computer y in language x. Now a single compile on a will produce a translator that can run on y, and the second compile can then be on y with a fully-bootstrapped system.

    The problem becomes simpler if the languages or machines don't differ.

    Bootstrapping can also be done incrementally, and perhaps this was more common 50 years ago.

    • Write a more powerful virtual machine (perhaps a stack machine or something with strings) in machine code
    • Now, writing in the VM's bytecode, write something closer to the language

    Something like Forth might make a good intermediate step.

提交回复
热议问题