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

real simplec grammar question

Is it possible to recursively define a production in sablecc? I want to be
able to do this: (add more [left] and [right]-type constructs to to make
things unique)

    conditional_expression =
        {rel} component_conditional_expression* l_par
        simple_conditional_expression r_par |
        {value} simple_conditional_expression |
	{complex} l_par [left]:conditional_expression r_par binop l_par
	[right]:conditional_expression r_par;

but sable won't let me. Is there another way such that a conditional
expression can be, e.g., (conditional_expression) &&
(conditonal_expression) where conditional_expression = 
simple_conditional_expression || conditional_expression where
conditional_expression = (x > y) && conditional expression where
conditional_expression = more stuff.