From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.devel Subject: Re: Bison-like source locations in LALR-parser Date: Wed, 13 Aug 2014 21:53:32 +0200 Organization: AvatarAcademy.nl Message-ID: <87d2c41803.fsf@drakenvlieg.flower> References: <1406966311-19014-1-git-send-email-janneke@gnu.org> <878umusx8s.fsf@gnu.org> 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 1407959641 19279 80.91.229.3 (13 Aug 2014 19:54:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2014 19:54:01 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Aug 13 21:53:56 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 1XHecM-0007YA-Q7 for guile-devel@m.gmane.org; Wed, 13 Aug 2014 21:53:54 +0200 Original-Received: from localhost ([::1]:49915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHecM-000116-77 for guile-devel@m.gmane.org; Wed, 13 Aug 2014 15:53:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHecG-0000zw-37 for guile-devel@gnu.org; Wed, 13 Aug 2014 15:53:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHecB-0003Ku-8q for guile-devel@gnu.org; Wed, 13 Aug 2014 15:53:48 -0400 Original-Received: from smtp-vbr6.xs4all.nl ([194.109.24.26]:1715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHec5-0003Jk-FN; Wed, 13 Aug 2014 15:53:37 -0400 Original-Received: from drakenvlieg.flower.peder.onsbrabantnet.nl (static.kpn.net [92.70.116.82] (may be forged)) (authenticated bits=0) by smtp-vbr6.xs4all.nl (8.13.8/8.13.8) with ESMTP id s7DJrWTJ084713 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 13 Aug 2014 21:53:35 +0200 (CEST) (envelope-from janneke@gnu.org) X-Url: http://AvatarAcademy.nl 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") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 194.109.24.26 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:17336 Archived-At: Ludovic Court=C3=A8s writes: Hi Ludo, > 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 rb= race) : `(,$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 --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20