Question: 4. The following grammar rules (somewhat simplified) are extracted from the Pascal-ISO-7185 grammar. VarAccess ComponVarIdent ComponVar IndexedVar | FieldDesig IndexedVar ArrayVar '[ Expr ,Expr ArrayVar-

4. The following grammar rules (somewhat simplified) are extracted from the Pascal-ISO-7185 grammar. VarAccess ComponVarIdent ComponVar IndexedVar | FieldDesig IndexedVar ArrayVar '[ Expr ,Expr ArrayVar- VarAccess FieldDesig -RecordVar '.' Ident | Ident RecordVar VarAccess This grammar is indirectly left recursive. a) Show how this grammar may be transformed into one involving a rule of the form VarAccess -Ident Selector b) Give the rule for Selector using EBNF 4. The following grammar rules (somewhat simplified) are extracted from the Pascal-ISO-7185 grammar. VarAccess ComponVarIdent ComponVar IndexedVar | FieldDesig IndexedVar ArrayVar '[ Expr ,Expr ArrayVar- VarAccess FieldDesig -RecordVar '.' Ident | Ident RecordVar VarAccess This grammar is indirectly left recursive. a) Show how this grammar may be transformed into one involving a rule of the form VarAccess -Ident Selector b) Give the rule for Selector using EBNF
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
