[antlr-interest] printing of tokens and output of parser!!

mark twain himmy070 at gmail.com
Thu Aug 7 09:44:29 PDT 2008


Hi,

I am new-bie to ANTLR, so just trying to run example: SimpleCalc code. I am
bit confused as which C runtime library function to use for print the token
stream

    tokens = antlr3CommonTokenStreamSourceNew  (ANTLR3_SIZE_HINT,
                                                    lex->pLexer->tokSource);

     /* Here I want to print the stream of token produced by lexer: what API
Code shoud I use??*/

     parser = SimpleCalcParserNew               (tokens);

     parser  ->expr(parser);

   /* Here I want to print the output of parser, say for addition(3+5)  I
want to see parser ouput:
    what API should I use?? */

Similary, if I take any example grammar for generating AST using C runtime,
please let me know how to display nodes of AST....
Sorry for such stupid doubts but I would be extremely thankful!!

Cheers:)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080807/190e9074/attachment-0001.html 


More information about the antlr-interest mailing list