When someone writes a new programming language, what do they write it IN?

前端 未结 13 1037
再見小時候
再見小時候 2020-12-07 06:57

Please excuse my ignorance. I\'m dabbling in PHP and getting my feet wet browsing SO, and feel compelled to ask a question that I\'ve been wondering about for years:

13条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 07:27

    Actually you can write in almost any language you like to. There's nothing that prevents you from writing a C compiler in Ruby. "All" you have to do is parse the program and emit the corresponding machine code. If you can read/write files, your programming language will probably suffice.

    If you're starting from scratch on a new platform, you can do cross-compiling: write a compiler for your new platform, that runs in Java or natively on x86. Develop on your PC and then transfer the program to your new target platform.

    The most basic compilers are probably Assembler and C.

提交回复
热议问题