What are modern and old compilers written for?

Since a compiler other than the interpreter only needs to translate the input and not run it, the performance itself should not be as problematic as the interpreter. Therefore, you should not write an interpreter, let them say Ruby or PHP, because it will be too slow.

However, what about compilers?

If you write a compiler in a scripting language, perhaps even with rapid development, you can reduce the source code and the initial development time in halv, at least I think so.

Of course: with a scripting language, I mean interpreted languages ​​that have typical functions that make programming faster, easier and more enjoyable for a programmer, as a rule, at least. Examples: PHP, Ruby, Python, possibly JavaScript, although this may be a strange choice for the compiler

  • What do compilers usually write? I believe you will answer something low level like C, C ++ or even Assembler, why?

  • Are there any compilers written in scripting languages?

  • What are the benefits (dis) of using low or high level programming languages ​​to write a compiler?

+3
source share
7 answers

, (bootstrapping).

, , .

+6

C ++. . 900 , , 2 20 .

( , , Pajamas - Python Javascript, Python), C ++.

+1

(C/++). , , (#/Java), (Haskell) , , (Nemerle).

, /.

-fu ( bootstrapping).

0

- , , :

, .

, , , C ++ .

0

Python Python, pypy.

0

, :

http://www.meta-alternative.net/mbase.html

: , JetBrains MPS .

, , , , , - Haskell, ML (F #, OCaml), Nemerle, Scala.

0

javac JVM SUN/Oracle Java; Java, Eclipse . , . (, GPU, GLSL/OpenCL) , .

, , , ; FORTRAN FORTRAN.

In fact, the compiler implementation language may or may not be the input language for this compiler, depending on the suitability of the participating languages ​​and many other criteria on the development time, the required performance at runtime, the availability of the tool, and developer familiarity.

0
source

Source: https://habr.com/ru/post/1739116/


All Articles