[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison-like source locations in LALR-parser

From: Jan Nieuwenhuizen
Subject: Re: Bison-like source locations in LALR-parser
Date: Wed, 13 Aug 2014 21:53:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Ludovic Courtès writes:

Hi Ludo,

> I don’t think this is needed.  Lexers are expected to use
> ‘make-lexical-token’ and ‘make-source-location’ from (system base lalr)
> to preserve source location information.

I hope you're right...and that's what I tried, but I didn't get it
working.  Possibly I need to cook-up a small example.

What I found was that, yes the LEXER has all it needs, but once you
get to construction rules in the parser; say

    (interface Identifier lbrace type-list event-list optional-behaviour 
rbrace) : `(,$1 ,$2 ,$4 ,$5 ,$6))

all it sees is the values, i.e. strings of the tokens that the lexer
sees.  The lexer cannot hand tokens to the parser, AFAICS.

What my patches do, is that for elements in the list that I construct
above that support source-properties, including the list itself, the
source location is set transparently.

Sometimes that is not enough, and you can use

   @1 ... @n

to set the source location explicitly.

> Besides, note that lalr.upstream.scm is a copy of the upstream lalr-scm,
> hosted at <>.

Yes...that's looks quit dead.  Isn't it?  I can try though...

Greetings, Jan

Jan Nieuwenhuizen <address@hidden> | GNU LilyPond
Freelance IT | Avatar®  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]