[antlr-interest] New user

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Aug 29 05:12:14 PDT 2002

on 8/29/02 14:03, Jason Yip at jasonyipwa at yahoo.com wrote:

> 1. I still don't understand what this mean and what it does:
>  #sql_statement = #([SQL_STATEMENT, "sql_statement"], #sql_statement);
>  What is it related to an imginary token? (I read the doc many times already)

imaginary token is something that not exists explicitly.
Best example -- Expression:

    "3+2" give you 3 tokens:   (+ 3 2)  or (PLUS INT INT)
    "4-2" give you 3 tokens:   (- 4 2)  or (MINUS INT INT)

But you have no EXPR token.
Usually we want have this token in the tree to proccedd ANY expression in
the same way. So we create it

    #expr = #([EXPR, "expr"], #expr);

And you get tree as
                (EXPR (PLUS INT INT))
                (EXPR (MINUS INT INT))

They have the same HEAD.

> 2. What is the structure of an AST? I can hardly find literally specification
> on the Internet. 

Described in docs !

> 3. What is the different between a parser and a tree parser. I knew it is
> something about 2D and 1D. But what 2D does and why is it better than 1D? I
> couldn't find any clear diagram to explain it.

Parser work with stream of tokens produced by Lexer.

Tree Parser walk by Nodes of AST produced by Parser
Tree parser works with nodes and their childs.

> 4. Is there any debugger so that I can trace how the grammar file?

For Java something
> 5. When do I use syntatic predicate and semantic predicate? Why does this
> semantic make sense: ( set_clause ) => set_clause ??!!

Described in docs !

> 6. What does match(_token) do? It matches what? Does it match the input
> stream? How come the tokens are Integers instead of String?

Stream of tokens

Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on at lists.macserve.net


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list