From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Nyacc: how to lex comments? Date: Mon, 16 Mar 2020 22:39:41 +0100 Message-ID: <20200316213941.GA5467@tuxteam.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="X1bOJ3K7DJ5YkBrT" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="111837"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Mar 16 23:08:58 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jDxus-000Syr-Mq for guile-user@m.gmane-mx.org; Mon, 16 Mar 2020 23:08:58 +0100 Original-Received: from localhost ([::1]:49812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxur-0005az-Kj for guile-user@m.gmane-mx.org; Mon, 16 Mar 2020 18:08:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55046) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxSb-0002OS-Ja for guile-user@gnu.org; Mon, 16 Mar 2020 17:39:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxSa-0007Xj-3a for guile-user@gnu.org; Mon, 16 Mar 2020 17:39:45 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:38652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDxSZ-0007GY-Hi for guile-user@gnu.org; Mon, 16 Mar 2020 17:39:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:Content-Type:MIME-Version:Message-ID:Subject:To:Date; bh=s5VC3PYuhR1L6lq10oQS1yH0J7IXRfHGk1qbAG0cq9w=; b=LgsT/xVNSbMJiXBxC080txJMqwkQg1YmP0QO6aLZ0+DRkhC0elfWnRJQs9XaM3v1n+V81b5qsHdnLFLqEuZUDzdmHD3CVlSSyjmb26WMYeGdyXMbyPOMktMyhqbDVeBDX/AsoGtDz3JEgSnNpKlKyDddv6d2nJzHdg/XfDHxg1IfKd1M0J7+O9FLx+Ky1JqY19trEzZRv62D7hjnZ29XYspTp2FfJVpG2gc6ATx9slsMvrZ6lt4UqexYOnZ97OtCjF7oWj+La1AGg5SOTMl8l5j3NDahliEMxlV6aVkHKB6R6z4IsqjQsh7jCgckQxCSxz6KWvcaZrsumgzg10Srjg==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1jDxSX-0001uJ-Iw for guile-user@gnu.org; Mon, 16 Mar 2020 22:39:41 +0100 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 5.199.139.25 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16313 Archived-At: --X1bOJ3K7DJ5YkBrT Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, in my quest to play parsing, I'm failing when I try to cope with comments. Here's an excerpt from my current file (define my-grammar (lalr-spec (start my-file) (grammar ;; boring grammar details elided ))) =20 (define mach (make-lalr-machine aq-grammar)) (define mtab (lalr-match-table mach)) (define gen-lexer (make-lexer-generator mtab #:comm-reader (make-comm-reader '(("#" . "\n"))))) (define raw-parse (make-lalr-parser mach)) (define (parse) (raw-parse (gen-lexer))) =20 ;; (gen-lexer) (parse) Comments are shell-like, from "#" to end of line. Grammar works fine so-far, but when (parse) sees a hash-comment (even just a one-line input # this is a comment it panics: Backtrace: In ice-9/boot-9.scm: 1736:10 6 (with-exception-handler _ _ #:unwind? _ # _) In unknown file: 5 (apply-smob/0 #) In ice-9/boot-9.scm: 718:2 4 (call-with-prompt ("prompt") # =E2=80=A6) In ice-9/eval.scm: 619:8 3 (_ #(#(#))) In ice-9/boot-9.scm: 2806:4 2 (save-module-excursion #) 4351:12 1 (_) In nyacc/parse.scm: 78:4 0 (_ _ #:debug _) =20 nyacc/parse.scm:78:4: Throw to key `nyacc-error' with args `("~A:~A: pa= rse failed at state ~A, on input ~S" "(unknown)" 1 0 " a comment")'. I feel I'm doing something stupid. What can I do to understand what's going on? Thanks & cheers -- tom=C3=A1s --X1bOJ3K7DJ5YkBrT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl5v8h0ACgkQBcgs9XrR2kZMTACaA70qY1/r9C8vXwolz0Bm37M3 YgAAnjoBnItoj3coTd0BeML16+wmltp7 =l7rS -----END PGP SIGNATURE----- --X1bOJ3K7DJ5YkBrT--