Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a simple compiler for a small language

People also ask

What is the easiest compiled language?

Java. Java is also one of the easiest programming languages to learn. There are tons of online resources to learn Java, one of the easiest and best programming languages to learn. Java is many developers' first exposure to the principles of Object-Oriented design.

Which compiler is best for beginners?

1) Borland Turbo C Turbo C is one of the basic and popular compilers for the C programming language. This was first introduced in 1987; it was popular for its small size, compilation speed, and low price.

Do all languages need a compiler?

No, compilers of high-level programming languages don't have to be written in C or any other "language closely related to machine". A compiler for any language can be written in any language.


If you want to look at code, I'm very impressed with Eijiro Sumii's MinCaml compiler.

  • It's only 2000 lines long.

  • It compiles a pretty interesting source language.

  • It generates real machine code, none of this namby-pamby C or LLVM stuff :-)

  • Speed of compiled code is competetive with gcc and the native OCaml compilers.

  • The compiler is designed for teaching.

Did I mention I've been very impressed?


I recommend TinyScheme or jonesforth.


Jack Crenshaw, a Ph.D. who has written extensively about practical numerical methods, was scared of compilers for a long time. He finally got tired of being scared, and wrote a multi-part tutorial on compiler construction, based on what he learned as he was teaching himself about the subject.

See "Let's Build a Compiler" for more information. Note that it isn't complete; he ran out of steam before he finished it, but there is a lot of easily-digestible information in there.


About 1000 lines of code. Compiles Scheme to LLVM assembler or to C. I would say this is an excellent fit for a paper on compilers. If you want to go deeper, I recommend the book "SICP".