Hi,
On 27 Jul 2010, at 12:02, Alberto Bacchelli wrote:
> Hi,
>
> In order to define a Java grammar in PetitParser, I am looking at how
> PetitSmalltalk is implemented.
>
> - Should a grammar like that of a programming language be
> created as a subclass of PPCompositeParser? What's the advantage over
> just a subclass of PPParser?
It offers a nice infrastructure to define the productions as methods
and reference them through instance variables.
Take the following example:
PPArithmeticParser>>terms
^ addition / factors
terms is a production that is defined in terms of two other
productions: addition and factors. These two productions are actually
instance variables in the PPArithmeticParser class and have
corresponding methods defining the productions. For example:
factors
^ multiplication / power
Cheers,
Doru
> - Unfortunately, I do not understand why PetitSmalltalk uses a
> PPSmalltalkTokenParser instead of a normal "token".
The comment of PPSmalltalkTokenParser says:
A parser that knows how to skip comments and whitespace in Smalltalk
and how to instantiate tokens.
Cheers,
Doru
> Thanks,
> Alberto
> _______________________________________________
> Moose-dev mailing list
>
[hidden email]
>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev--
www.tudorgirba.com
"Value is always contextual."
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev