From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: Bison-like source locations in LALR-parser Date: Wed, 13 Aug 2014 23:01:47 +0200 Message-ID: <87y4us2jes.fsf@gnu.org> References: <1406966311-19014-1-git-send-email-janneke@gnu.org> <878umusx8s.fsf@gnu.org> <87d2c41803.fsf@drakenvlieg.flower> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1407964017 7931 80.91.229.3 (13 Aug 2014 21:06:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2014 21:06:57 +0000 (UTC) Cc: guile-devel@gnu.org To: Jan Nieuwenhuizen Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Aug 13 23:06:52 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XHfky-0005Qz-2m for guile-devel@m.gmane.org; Wed, 13 Aug 2014 23:06:52 +0200 Original-Received: from localhost ([::1]:50254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHfkx-0005tG-JP for guile-devel@m.gmane.org; Wed, 13 Aug 2014 17:06:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHfki-0005W7-LP for guile-devel@gnu.org; Wed, 13 Aug 2014 17:06:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHfke-000734-0r for guile-devel@gnu.org; Wed, 13 Aug 2014 17:06:36 -0400 Original-Received: from hera.aquilenet.fr ([2a01:474::1]:33160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHfg6-0005Nn-Hn; Wed, 13 Aug 2014 17:01:50 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 169F53769; Wed, 13 Aug 2014 23:01:49 +0200 (CEST) Original-Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4RuPvlnbTNXg; Wed, 13 Aug 2014 23:01:48 +0200 (CEST) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 8B9D41247; Wed, 13 Aug 2014 23:01:48 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 Thermidor an 222 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <87d2c41803.fsf@drakenvlieg.flower> (Jan Nieuwenhuizen's message of "Wed, 13 Aug 2014 21:53:32 +0200") User-Agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:474::1 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17337 Archived-At: Hi, Jan Nieuwenhuizen skribis: > Ludovic Court=C3=A8s writes: > >> I don=E2=80=99t think this is needed. Lexers are expected to use >> =E2=80=98make-lexical-token=E2=80=99 and =E2=80=98make-source-location= =E2=80=99 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. Here=E2=80=99s an example: http://git.savannah.gnu.org/cgit/guile-rpc.git/tree/modules/rpc/compiler/le= xer.l http://git.savannah.gnu.org/cgit/guile-rpc.git/tree/modules/Makefile.am#n58 http://git.savannah.gnu.org/cgit/guile-rpc.git/tree/modules/rpc/compiler/pa= rser.scm#n101 Note that actually, the =E2=80=98location=E2=80=99 produced by Makefile.am = does: (make-lexical-token type (make-source-location ...) (append value (list (vector line column)))) So the line/column info is also stored alongside the token=E2=80=99s value,= and then access from parser.scm with those cadr calls. >> 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... Well, that=E2=80=99s because it=E2=80=99s =E2=80=9Cfinished.=E2=80=9D :-) But yeah, it=E2=80=99s worth trying. Dominique has been responsive and hel= pful in the past. Thanks, Ludo=E2=80=99.