[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: VIM stylesheet / AST question
Hi Roger, All
On Mon, 26 May 2003, Roger Keays wrote:
> Hi All,
>
> Attached is a VIM stylesheet which supports the new AST grammar.
>
> One other question: I am wondering if the following should be legal:
>
> exp_list -> exp+ = exp exp_list_tail? -> () ;
The plus(+) operator in SableCC3 production transformations only means
that a list is needed regardless if this list is empty or not.
I can understand your confusion. We should only allow the * operator. It
would be more clear.
>
> Is there any difference between the + and * operators in a
> transformation? Also, is there any impact if a term with a? is
> referenced (but it might not actually be used). e.g.
>
> production -> ast_node = term1 term2? term3 -> New ast_node(term1,
> term2);
>
No, there is no impact. Why? because SableCC makes internal
transformations to the grammar. So this is the exact production on which
SableCC will work :
production -> ast_node = term1 term2 term3 -> New ast_node(term1, term2) |
term1 term3 -> New ast_node(term1, Null);
> ...
>
> Thanks again,
>
> Roger Keays
>
>
Thanks,
Kevin