I would like to write a translator for a legacy system. I have started using moo as the lexer and that seems to be going well, but I am a bit concerned with the parsing side of things. If I have a legacy statement like;
So this might look like;
REPLACE myField WITH 1, myOtherField WITH 2 FOR mField ==5 IN thisTable
Where each [option] is optional and some elements ( FieldName1 WITH eExpression1 ) may repeat many times. How would I parse that? There seems to be too many possible combinations.
I would like to write a translator for a legacy system. I have started using moo as the lexer and that seems to be going well, but I am a bit concerned with the parsing side of things. If I have a legacy statement like;
REPLACE FieldName1 WITH eExpression1 [ADDITIVE] [, FieldName2 WITH eExpression2 [ADDITIVE]] ... [Scope] [FOR lExpression1] [WHILE lExpression2] [IN nWorkArea | cTableAlias] [NOOPTIMIZE]
So this might look like; REPLACE myField WITH 1, myOtherField WITH 2 FOR mField ==5 IN thisTable
Where each [option] is optional and some elements ( FieldName1 WITH eExpression1 ) may repeat many times. How would I parse that? There seems to be too many possible combinations.