188Views12Replies

Author Options:

how can we make a compiler?? Answered

Discussions

0
None
steveastrouk

8 years ago

If you have to ask the question, you need a much longer answer than its possible to write here.

You need some books. One classic is known as the Dragon Book.

http://en.wikipedia.org/wiki/Dragon_Book_%28computer_science%29

And you could study Tiny Pascal and Small-C, both written many years ago.

Modern, optimising, recursive compilers are seriously nasty beasts (worse than dragons) to design, and I wouldn't dream of it for anything like a casual interest.

Steve

0
None
Re-designsteveastrouk

Answer 8 years ago

What, you mean they don't have a program like "visible compiler writer" or something?

0
None
steveastroukRe-design

Answer 8 years ago

There is always one called YACC, Yet another Compiler Compiler.....but I really would call it a visible compiler writer ;-)

0
None
orksecuritysteveastrouk

Answer 8 years ago

Despite its name, YACC is more of a grammar writer than a compiler writer (one stage up from LEX, which is the companion tokenizer). It's still the coder's responsibility to write the actual compilation process driven by that FSM... and for a serious compiler, it's more common to use the grammar to produce an internal program representation which is then operated on (optimized in various ways) before the actual compilation to machine code takes place.

As Steve's other note said, the Dragon Book is a classic starting point for this. Older editions can often be found cheap, and are Good Enough for an amateur.

0
None
harry88

8 years ago

imp to much $ needed and you need to know how to install microprocessors
and memory chips in place with every thing else its almost impossible but you could try

0
None
dungeon runnerharry88

Answer 7 years ago

Sorry, between attempting to interpret your abbreviations and trying to bring mental order to the punctuationless mess you call a sentence, I seem to have come to the conclusion that you are trying to say that: One, Money in large amounts is needed for the task (untrue), and Two, that knowledge of installing hardware is needed for the task (although knowledge of assembly and how things like RAM memory works, you'd hardly be working with physical hardware). Sir, I humbly and seriously question your knowledge of both English and Computer programming.

0
None
orksecurity

8 years ago

What are you actually trying to accomplish? Why do you need a new compiler?

0
None
rickharris

8 years ago

Why would you want to? If you have a good reason then judging from the low level start of your question you have a STEEP learning curve.

0
None
orksecurityrickharris

Answer 8 years ago

Gotta agree with this too. Doing it right can be a big project even for a team of professionals. Doing it sloppily often isn't worth doing except, perhaps, as a learning exercise.

0
None
lemonie

8 years ago


Go on then - in what machine-code?

L

0
None
kelseymh

8 years ago

Start with a compiler for some programming language. Write a program in that language which translates strings of text into operations on the computer. Compile that program using your compiler. Now feed your new program files containing the strings of text. You've just written yourself a new compiler. How you solve the chicken-and-egg problem is usually termed "assembly language."