[antlr-interest] C to assembler compiler
Micheal J
open.zone at virgin.net
Thu May 26 07:56:34 PDT 2005
> 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.
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?
Micheal
More information about the antlr-interest
mailing list