compiler generator - compiler interpreter

Started by 0x401000, July 04, 2009, 11:04:36 AM

Previous topic - Next topic

0x401000

A compiler-compiler or compiler generator is a tool that creates a parser, interpreter, or compiler from some form of formal description. The earliest and still most common form of compiler-compiler is a parser generator, whose input is a grammar (usually in BNF) of a programming language, and whose generated output is the source code of a parser.

The ideal compiler compiler takes a description of a programming language and a target instruction set architecture, and automatically generates a usable compiler from them. In practice, the state of the art has yet to reach this degree of sophistication and most compiler generators are not capable of handling semantic or target architecture information.

Want to know more about compiler-compilers or compiler generators, can somebody already wrote analogues of these programs, there is a program HLA2.zip with kompilyatornym generator, but from the official site it does not download. Books on the topic are welcome.

Is the program still Vmgen (Gforth 0.6.1), so Vm generator for the forth, perhaps it uses the same technology.

Thanks

d0d0

Hi 0x40100

IMO you'll need to learn some of the following:

1. Automata Theory (Finite Automata) (A must!) - regular expressions, finite state machines etc
2. Formal Syntax and Semantics of Programming Languages (A must)
3. Parsing techniques (Important)
4. Algebraic theory of automata and languages (Optional if you're into math)


You definatly need to know the first 2 i.e theory
Some books that might help
1. Theory of finite automata with an introduction to formal languages by John Carrol (Old book)
2. Formal Syntax and Semantics of Programming Languages by Kenneth Slonneger (AW publishing)
3. Parsing Techiniques - a practical guide by Dick Grune (Springer)
4. An Introduction to Formal Languages and Automata
5. compiler books

Also check out the GRAIL+ project for experimenting with FSM, Regular expressions, finite languages etc.

Hope that helps

latte

Quote from: 0x401000 on July 04, 2009, 11:04:36 AM
A compiler-compiler or compiler generator is a tool that creates a parser, interpreter, or compiler from some form of formal description. The earliest and still most common form of compiler-compiler is a parser generator, whose input is a grammar (usually in BNF) of a programming language, and whose generated output is the source code of a parser.
( snip )
Hi 0x401000 -
Although it's not assembly, you might want to have a look at Boost::Spirit - an excellent parsing framework in C++. 
With that, you can code parsers, interpreters etc directly in C++ using a very BNF-like syntax.  I've used Spirit quite a lot, and it really is easy - as easy as coding in (say) Python!  It doesn't really feel like C++ at all.... :) 
Anyway, just thought I'd mention it, as parsing is one of my areas of interest.... ;) 
- latte