How to define Pascal variables in PetitParser
问题 Here is the (simplified) EBNF section I'm trying to implement in PetitParser: variable :: component / identifier component :: indexed / field indexed :: variable , $[ , blah , $] field :: variable , $. , identifier What I did was to add all these productions (except identifier ) as ivars of my subclass of PPCompositeParser and define the corresponding methods as follows: variable ^component / self identifier component ^indexed / field identifier ^(#letter asParser, (#word asParser) star)