[antlr-interest] Embedded Systems Parsing .....

Jim Idle jimi at temporal-wave.com
Fri Jan 25 07:21:11 PST 2008


Not sure exactly what you are trying to do here, but I sounds like you
want to parse some languages using grammar generating the C target code,
then when you have parsed the language, you wish to make calls into a
pre-existing backend library (also in C) to generate target code for the
language?

 

This should be extremely simple. The fact that you are using C makes no
difference really to the way you construct the grammar and so on, but
once you have produced a tree for the parse, you walk it with an ANTLR
tree parser and either do semantic checking as you code generate or do a
semantic pass then a code generation pass (this can get as complicated
as you need of course).

 

In the code generation pass, you embed your calls to the C libraries.
The calls are just embedded function calls (try to keep the amount of
code you put in to the grammar to an absolute minimum – function calls
and a few tracking structures in scopes perhaps.

 

Now, you may have meant that you want to parse the code, then use a
different library to generate the tree, this is done by a similar
process and you can either implement your own tree adaptor, tree nodes
and tree walkers or just embed calls in the parser rather than the tree
parser.

 

Getting started with real grammars is easiest with the ANTLR book,
though it is not strictly necessary. You should probably start by
reading the articles on the Wiki, then the docs for the C target API.
Also, download the examples tar/zip on the ANTLR download pages. In
there you will find the C sub directory which contains the example
grammars set up for working in C.

 

Finally, you could just contract it all out to me ;-)

 

Jim 

 

From: Mohammed Ibrahim Mohammed [mailto:snouto at gmail.com] 
Sent: Friday, January 25, 2008 1:22 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Embedded Systems Parsing .....

 

I need to generate parsers using antlr tool targetting some embedded
Systems based on specific backend C library for each target MCU , i need
antlr to use this C library to generate the parser codes ,  How can i do
that ????? and if there is any online tutorial for that please write it
down !!!!

 

 

 

snouto,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080125/aaf4c4cf/attachment.html 


More information about the antlr-interest mailing list