parser for context sensitive grammars?

Alan Reider squeak at ajr.e4ward.com
Sun Jan 23 20:14:06 UTC 2005


Ferdinand,

I have written a soon-to-be-released parser tool called MEPS in which this 
parse could be written (among other ways) as follows:

'Egon sees Erna.' readStream
 match:[ :i | i matchOneOf: #('Egon' 'Erna' 'Emma') action:[:subj|subj]]
 and: $ 
 and: 'sees'
 and: $ 
 and: [: i | i matchOneOf: #('Egon' | 'Erna' | 'Edna') action:[:obj|obj]]
 and: $.
 action: [ : sentence | sentence]

This works fine and returns:
 anOrderedCollection('Egon' $  'sees' $  'Erna' $.)

-Alan

On Sunday 23 January 2005 12:41, Ferdinand Strixner wrote:
> Hi,
>
> obviously SmaCC seems only to handle LALR(1) or LR(1) context free
> grammars. Does anyone know a parser generator that can handle grammars
> like this:
>
> <subject>: Egon | Erna | Emma;
> <object>: Egon | Erna | Edna;
> <verb>: sees;
> <point>: \.;
> <space>: \s;
>
> Sentence: <subject> <space> <verb> <space> <object> <point>;
>
> (SmaCC compiles this grammar but doesn't recognize sentences like "Egon
> sees Erna" but only "Emma sees Edna" and perhaps because of the order of
> the token definitions "Egon sees Edna".)
>
> Thanks for any suggestions,
> Ferdinand



More information about the Squeak-dev mailing list