[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anybody listening?

 --- james@spunkysoftware.com wrote: > Hey Thanks. In
the grammar files:
> What are the parts in curly braces {like_this} - are
> these productions?
No, they are called alternatives and are used to
identify a specific alternative of a production.

> What are the parts in square brackets with colons
> [like]:this

This are used when an element appears twice in an
alternative. e.g:

let's say we have the following alternative of
production statement:

statement = 
  {multiply} expression multiply expression |

This is an error in sablecc. it has to do with the
enforcement of the tree property of the AST. So, you
would do it like this:

statement =
  {multiply} [left]:expression multiply 
             [right]:expression |

So, when you implement the DepthFirstAdapter or any
other Adapter you can get the node with getLeft() or

anyway, I'm skipping loads of stuff here. Just
download the thesis from www.sablecc.org and read
chapter 2 and 3. That should be enough to get you

> Can I find a tutorial/reference on EBNF notation as
> it applies to SableCC
> grammars somewhere?
Just like a mentioned above, you could read just the
thesis, but You could also get the Dragon Book, by
Alfred Aho

> Do I need ant and xerces? It would take me forever
> to download these but I'm
> sure it would make building and installing things
> much easier. Should I get
> them; is it worth it?

No, you don't need Ant or xerces. I'm not using it
yet, So I don't really know the advantages of it.

Could anyone else answer to this one?

Just read chapters 2 and 3 of the thesis and if you
have any query regarding to that, then just send it to
the list, all right?

I don't know what your knowlegde regarding compiler
design is, but I assume that you are just starting
out. So, just read it.

All the best
Fidel Viegas, BEng

Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie