From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.user Subject: Re: lalr parser: on Bison-like source locations Date: Tue, 28 Oct 2014 18:11:36 +0800 Message-ID: References: <8738aazj51.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 1414491116 24175 80.91.229.3 (28 Oct 2014 10:11:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 10:11:56 +0000 (UTC) Cc: Guile User , =?UTF-8?Q?Ludovic_Court=C3=A8s?= To: Jan Nieuwenhuizen Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Oct 28 11:11:51 2014 Return-path: Envelope-to: guile-user@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 1Xj3kl-0001OV-47 for guile-user@m.gmane.org; Tue, 28 Oct 2014 11:11:51 +0100 Original-Received: from localhost ([::1]:38306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj3kk-0003ON-Cj for guile-user@m.gmane.org; Tue, 28 Oct 2014 06:11:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj3ka-0003OH-NS for guile-user@gnu.org; Tue, 28 Oct 2014 06:11:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xj3kZ-0007Eo-4M for guile-user@gnu.org; Tue, 28 Oct 2014 06:11:40 -0400 Original-Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:59526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj3kY-0007Ee-SA; Tue, 28 Oct 2014 06:11:39 -0400 Original-Received: by mail-la0-f44.google.com with SMTP id gf13so283890lab.31 for ; Tue, 28 Oct 2014 03:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=LfC8/4Ps2xoEcp3f7B8OclCRqeUMVyKwYtUtKZSw0wU=; b=KO82RkeyavYkHgFQxTVu0fbalo8C0JcNyO8PulkmIB7MnIRZdoknhXdxiQOmPjUF+T 3Ys/iqqhZnS06fkprxk8WHA0O3WUEujQSU650MYURd5CTE9QL9uotNwTdxFV7YddrgzL 6uptz5YS+1w8RJJvVm4aJysrhe/F7/ucpYwipN3qvcm56N76npw0iLHdl6vynBxhiFqq 2b1i3JQBABzGnxn/j3/tcdoPEoo6RgyWC/KpMWVE/HzqMz1QrzYEQ01dh/L+8Cz+XUmL p/M+WMEjnJy2Uu/RWEnFpmZC6rjZaq5inm9XDkc78XHzogKVR4v1HkTYLUm3ail2ahFz 2HcA== X-Received: by 10.112.148.161 with SMTP id tt1mr2692957lbb.67.1414491096623; Tue, 28 Oct 2014 03:11:36 -0700 (PDT) Original-Received: by 10.152.28.105 with HTTP; Tue, 28 Oct 2014 03:11:36 -0700 (PDT) In-Reply-To: <8738aazj51.fsf@drakenvlieg.flower> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22c X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11603 Archived-At: Thanks for reply! I wonder if Guile master has updated to the latest lalr-scm, since I can't see the expected result. If the answer is no, I have to request for it, it's important for our multi-lang hacking. Thanks! On Mon, Oct 27, 2014 at 4:11 AM, Jan Nieuwenhuizen wrote: > Hi, > > Saw your question on irc. > > Attached is a modification on your `simple' language that demonstrates > transparent source locations. > > The explicit, Bison-like locations work just like they do in Bison...eg > something like: > > ;; helper > (define (note-location ast loc) > (when (supports-source-properties? ast) > (set-source-property! ast 'loc loc)) > ast) > > (define (make-parser) > (lalr-parser > ;; ... > ;; production rules > (variable > (type Identifier =3D expression semicolon) : `(variable ,$2 ,$1 ,(no= te-location `(expression ,$4) @3)) > (Identifier dot Identifier Identifier =3D expression semicolon) : `(= variable ,$4 (type ,$3 ,$1) ,(note-location `(expression ,$6) @5))) > > Does that answer your question? > > Greetings, Jan > > > > -- > Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org > Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.= nl >