[plt-scheme] Parser Tools group-id for tokens

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Thu Nov 27 06:38:52 EST 2008

On Wed, Nov 26, 2008 at 4:28 PM, Jon Rafkind <workmin at ccs.neu.edu> wrote:
>
>>
>> Not bothersome at all. I just couldn't and maybe still can't see the
>> point, since the usual way is to pass one token into the parser. Why
>> pass a group of them?
>>
>>
>
> But the tokens are the things you can use in the grammar. If you only passed
> in one token how would you match more than one of the lexemes?
>

I didn't make myself clear. You pass the several tokens but only one
per lexeme. Question is, in which quite of application would you need
to refer to the identifier c-val-tokens (from your example).

> Some code from a lexer
> (define-tokens c-val-tokens
>   (number-literal     char-literal))
>
>
> And from the parser
> (constant
>         [(number-literal) (make-exp:const 'number $1)]
>         [(char-literal) (make-exp:const 'char $1)])
>



-- 
Paulo Jorge Matos - pocmatos at gmail.com
Webpage: http://www.personal.soton.ac.uk/pocm


Posted on the users mailing list.