[stringtemplate-interest] translation help required

vijay e vijaydone at gmail.com
Sat Oct 2 03:41:29 PDT 2010


hi
thanks for your reply.

can i get a ANSI C grammer completely so tht i can use it, the grammer given
in antlr fails in many cases, pls help

On Sat, Oct 2, 2010 at 12:42 PM, Harald Mueller <harald_m_mueller at gmx.de>wrote:

> Hello -
>
> This is usually tricky, as C has very bad "hooks" where a parser can
> reliably start up.
> What I would do:
> * Lexing: Write (or copy) a standard C lexer;
> * Parsing: Use ANTLR 3 with its LL* parsing and syntactic and maybe
> semantic predicates to find places where the parse can start up. You need
> rules like
>    program : item+ ;
>
>    item : (pattern1) -> ...
>         | (pattern2) -> ...
>         | .                 { copy it to output; }
>         ;
>
> I'd say.
>
> * Separate writing the output from the parsing machinery - "separation of
> concerns".
>
> Sorry - only very general advice ...
>
> Harald M.
>
> -------- Original-Nachricht --------
> > Datum: Sat, 2 Oct 2010 09:21:37 +0530
> > Von: vijay e <vijaydone at gmail.com>
> > An: stringtemplate-interest at antlr.org
> > Betreff: [stringtemplate-interest] translation help required
>
> > Hello
> > I am doing  a code translator , where i just need to find certain
> patterns
> > in my C code and change few lines in tht pattern, is there any way where
> i
> > can do this translation without writin my entire C Grammar, because i am
> > interested in only very few patterns, so without writin the grammar for
> > other patterns , is thr a way to do the translation
> >
> >  i got a mail reply tellin me to use FILTER options as true, but if i set
> > my
> > filter options as true, i will be able to modify my tokens as per my
> need,
> > but i dont know how i can make these changes reflect in my original file,
> > help needed
> > any ideas will be of great use
> > --
> > Vijay.E,
> > Mtech (Pursuing),
> > Department of Computer Science,
> > IIT Madras.
>
> --
> GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
> Jetzt freischalten! http://portal.gmx.net/de/go/maxdome
>



-- 
Vijay.E,
Mtech (Pursuing),
Department of Computer Science,
IIT Madras.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20101002/6d72e913/attachment.html 


More information about the stringtemplate-interest mailing list