[antlr-interest] C to assembler compiler

Lloyd Dupont lloyd at nova-mind.com
Thu May 26 22:17:01 PDT 2005


personally I thinking starting with ANTLR is not a problem.....
the only issing thing is a 'ANTLR for the dummy' book
but you could try to be patient and perseverant and read the online book, 
although it's not for the dummy it's more friendly than many spec!

----- Original Message ----- 
From: "Igor Inas" <igor.inas at gmail.com>
To: "'antlr-interest' Interest" <antlr-interest at antlr.org>
Sent: Friday, May 27, 2005 1:11 AM
Subject: Re: [antlr-interest] C to assembler compiler


On 5/26/05, Micheal J <open.zone at virgin.net> wrote:
> > I am taking a course in compilers this year. The practical
> > part of the exam was to implement a compiler which translates
> > C source code to assembler. The C is a very very simple one,
> > with no pointers, no arrays as arguments and so on.
> >
> > We were instructed to use bison, but the first paragraph of
> > bison manual says: "You need to be fluent in C programming in
> > order to use Bison." which made me to look after a Java
> > alternative. And since Antlr has a very nice webpage I chose
> > that one :)
>
> I'd suggest learning Flex/Bison anyways (despite ANTLR's obvious 
> strengths).
> Perhaps Jflex/CUP - or Jflex/Jay - if Java is your preferred 
> implementation
> language.
>

Hmm, I was not able to find Bison alternatives for Java before. I will
have a look at CUP and Jay later perhaps.

> Doesn't hurt to have the additional skill/option...
>
> > The result can be downloaded at
> > http://sprite.edi.fmph.uniba.sk/~inas/antlr/
> >
> > There are still
> > some unresolved issues, and at the end, when deadline was
> > coming near, I wrote more and more ugly code.
>
> My quick perusal noticed the lack of a symbol table. Didn't think you 
> could
> parse most languages without such a beast, did I miss something?
>

I only use parser to generate AST. I do all the semantic checking and
other actions on the second pass on the AST.

> Micheal
>
> 



More information about the antlr-interest mailing list