This project has moved and is read-only. For the latest updates, please go here.

error recovery

Jan 14, 2010 at 10:18 PM

How do I activate error recovery? Is there any way I could indicate some syncronization points in the grammar?


Jan 14, 2010 at 10:25 PM

assign NonTerminal.ErrorRule property - look at c# grammar as an example

Jan 14, 2010 at 10:43 PM

Excellent ! Now it is working !

Last question I hope

I need to match something like this

{ A, B, C, D, }

I tried with the star rule, however, the delimiter is only used inside. So when I tried to add it at the end, it is not working

MakeStarRule(nt_fields, t_comma, nt_field) + t_comma.


Why is this happening?

Thanks again. I really like your work, and you've been very helpful today.

Jan 14, 2010 at 11:23 PM

you'll have to create an extra non-terminal containing the list plus optional comma. I already recognized that this is a common case, so i'm working on adding support for this optional tailing delimiter in list-making methods

Jan 15, 2010 at 12:04 AM

When I try to do that I get the following error:

Shift-reduce conflict. State S20, lookaheads [,]. Selected shift as preferred action.


State S20 (Inadequate)
  Shift items:
    Field+ -> Field+ ·, Field 
  Reduce items:
    Fields -> Field+ · [, } )]
  Transitions: ,->S32, 

State S20 (Inadequate)

  Shift items:

    Field+ -> Field+ ·, Field 

  Reduce items:

    Fields -> Field+ · [, } )]

  Transitions: ,->S32, 

Contents  (Nullable) 
   Contents -> BodyId , FieldsComma 
   Contents -> FieldsComma 
   Contents -> Value 
   BodyId -> Name 
   BodyId -> Number 
FieldsComma  (Nullable) 
   FieldsComma -> Fields 
   FieldsComma -> Fields , 
Fields  (Nullable) 
   Fields -> 
   Fields -> Field+ 
   Field+ -> Field 
   Field+ -> Field+ , Field 
   Field -> Name = Value 
I have tried a lot of alternatives, but I still don't get it...


Jan 15, 2010 at 12:09 AM

please post the source code of grammar constructor, at least a reduced version with all involved terminals and non-terminals