unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: Bison-like source locations in LALR-parser
Date: Wed, 13 Aug 2014 21:53:32 +0200	[thread overview]
Message-ID: <87d2c41803.fsf@drakenvlieg.flower> (raw)
In-Reply-To: <878umusx8s.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 11 Aug 2014 20:21:39 +0200")

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-spec
    (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 <http://code.google.com/p/lalr-scm/>.

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

Greetings, Jan

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  



  reply	other threads:[~2014-08-13 19:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-02  7:58 Bison-like source locations in LALR-parser Jan Nieuwenhuizen
2014-08-02  7:58 ` [PATCH 1/2] LALR-parser: provide bison-like location constructs @1 ... @n Jan Nieuwenhuizen
2014-08-02  7:58 ` [PATCH 2/2] LALR-parser: transparent source locations using source-proprerties Jan Nieuwenhuizen
2014-08-11 18:21 ` Bison-like source locations in LALR-parser Ludovic Courtès
2014-08-13 19:53   ` Jan Nieuwenhuizen [this message]
2014-08-13 21:01     ` Ludovic Courtès
2014-10-05 10:27       ` Bison-like source locations in LALR-parser -- upstream update Jan Nieuwenhuizen
2014-12-02 20:27         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2c41803.fsf@drakenvlieg.flower \
    --to=janneke@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).