From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: nyacc version 0.71.0 released Date: Tue, 21 Jun 2016 05:55:06 -0700 Message-ID: <71C39F15-427D-4043-97E7-F0593CE8EDC3@gmail.com> References: <41775BE0-4A4E-469E-9550-7FD4E47481BE@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466513765 30570 80.91.229.3 (21 Jun 2016 12:56:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2016 12:56:05 +0000 (UTC) Cc: guile-user@gnu.org To: Chaos Eternal Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jun 21 14:55:52 2016 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 1bFLDV-0002X7-Kv for guile-user@m.gmane.org; Tue, 21 Jun 2016 14:55:45 +0200 Original-Received: from localhost ([::1]:51524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLDU-0007Oh-Th for guile-user@m.gmane.org; Tue, 21 Jun 2016 08:55:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLCy-0007M2-Rb for guile-user@gnu.org; Tue, 21 Jun 2016 08:55:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFLCw-000616-Dm for guile-user@gnu.org; Tue, 21 Jun 2016 08:55:11 -0400 Original-Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:36171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFLCw-00060g-2T for guile-user@gnu.org; Tue, 21 Jun 2016 08:55:10 -0400 Original-Received: by mail-pa0-x235.google.com with SMTP id wo6so6259265pac.3 for ; Tue, 21 Jun 2016 05:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0/u0kqtsphH4/ZOXNkieLZR1NJeo3pwV7wC/+lDUZrY=; b=UAfUTqqpYxL9QFMNakgaEFni6S9jIPasX3+XYYO4iLvDKEB9F63HSGsv432iNXOe6z 60v6yl52K5FOHzMrKWgdU+hhO2b8Eby1v6zaHZdDGo+zDxtjx+ajssZbTFSzkv44OOfX YZcZ2rrjbOjla+5mcRlZ7nbKMjmic69tH3aeFfuDoghJemTroS2S2mFu8ozH2buov5mF Wv1F7swQ3+1tyOIVbIDnKEF07AnJ3omEQYYm7jHxyrjvff2gCJ8EFQdmmz0JFyxuMmbr mSYDH/cRtYbJpDJhL90Bc9NeuvFXINWXtO+wLTl5xUkN0PeLNXX2OpfV/1bgZqOUG0XK ysDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0/u0kqtsphH4/ZOXNkieLZR1NJeo3pwV7wC/+lDUZrY=; b=WnixdODTwsLAcmIEkSgtMGRG+UaDNpGlTZgn1F1LbI6rhDnM/Zn7UmUsHRSY29sBCh wZbTwioiwXdrgP4WzK+mP+NOvSpZ02LAjBDyvFFWHi/2DuwFh9r21+OrazZsOJWbtZqT SgMnpEAX0bYV6BJv9MMXcLYwRfQ640YeIUkTJcZBaASXOSoOqtIaAHMLIDUb9mZJbGoN AGWTZXY6yw4ZrbmzsnrTU09E74zfew3udOIVe4ryhJBQwrRH/xGL9HTEv7ayM1IzL2jp 1XOJTNTlMB3d7UEBE2U33QJYMnWIxH9yNmKAD9lZbs//hvOWY7j01Yd3M8cfjKwg9qX9 wing== X-Gm-Message-State: ALyK8tKv6HtswR3FK1R8riw+RrXw/v/MpFw2KemF+SSSOenenKqDD4g131pWPAh8w6hOcg== X-Received: by 10.66.47.133 with SMTP id d5mr28576732pan.48.1466513709014; Tue, 21 Jun 2016 05:55:09 -0700 (PDT) Original-Received: from nautilus.championbroadband.com (216-165-228-109.championbroadband.com. [216.165.228.109]) by smtp.gmail.com with ESMTPSA id xt1sm96130552pac.7.2016.06.21.05.55.07 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2016 05:55:07 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.2104) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::235 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.lisp.guile.user:12674 Archived-At: Like I said: =E2=80=9Cbeta code." It=E2=80=99s gonna have bugs. I will = check against my latest. The last iteration included work on the CPP. > On Jun 21, 2016, at 5:21 AM, Chaos Eternal = wrote: >=20 > Hi, >=20 > I met with this message when I want to parse UnixODBC's header file: > but guile version is 2.0.11 >=20 > $ ./cxp -Ilang/c99/ -I/usr/include /usr/include/sql.h > Backtrace: > In ice-9/boot-9.scm: > 4052: 19 [#] > In unknown file: > ?: 18 [load-compiled/vm > = "/home/chaos/.cache/guile/ccache/2.0-LE-8-2.0/home/chaos/src/nyacc/example= s/nyacc/cxp.go"] > In ice-9/boot-9.scm: > 768: 17 [for-each # /home/chaos/src/nyacc/examples/nyacc/./cxp:52:3 (file)> ...] > In /home/chaos/src/nyacc/examples/nyacc/./cxp: > 53: 16 [# /home/chaos/src/nyacc/examples/nyacc/./cxp:52:3 (file)> > "/usr/include/sql.h"] > In ice-9/boot-9.scm: > 867: 15 [call-with-input-file "/usr/include/sql.h" ...] > In ice-9/r4rs.scm: > 172: 14 [with-input-from-port # /dev/pts/3>> ...] > In ice-9/boot-9.scm: > 157: 13 [catch parse-error ...] > In unknown file: > ?: 12 [with-fluid* # # ...] > In ../../../../module/nyacc/parse.scm: > 120: 11 [# (lexr #:key debug)> # = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/body.scm:= 246:8 > ()> ...] > In > = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/body.scm:= > 371: 10 [# = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/body.scm:= 246:8 > ()>] > 349: 9 [read-token] > 277: 8 [exec-cpp "include \"sqltypes.h\""] > In ice-9/boot-9.scm: > 867: 7 [call-with-input-file "/usr/include/sqltypes.h" ...] > In ice-9/r4rs.scm: > 172: 6 [with-input-from-port # /usr/include/sql.h 5>> ...] > In ../../../../module/nyacc/parse.scm: > 120: 5 [# (lexr #:key debug)> # = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/body.scm:= 246:8 > ()> ...] > In > = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/body.scm:= > 371: 4 [# = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/body.scm:= 246:8 > ()>] > 349: 3 [read-token] > 294: 2 [exec-cpp "if (ODBCVER >=3D 0x0300)"] > In ice-9/boot-9.scm: > 157: 1 [catch error ...] > In > = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.s= cm: > 69: 0 [eval-expr (ge (ident "ODBCVER") (fixed "0x0300"))] >=20 > = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.s= cm:69:22: > In procedure eval-expr: > = /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.s= cm:69:22: > In procedure >=3D: Wrong type argument in position 1: #f > chaos@florrum:~/src/nyacc/examples/nyacc >=20 >=20 >=20 > On Fri, Apr 15, 2016 at 9:35 PM Matt Wette = wrote: >=20 >> nyacc version 0.71.0 is released as beta >>=20 >> nyacc is a LALR parser generator written from the ground up in guile >>=20 >> Features/Updates: >> * clean scheme-flavored syntax for grammar specification >> * prototype parsers for C99,(partial) javascript, matlab that output = parse >> trees in a SXML format >> * update: C99 preprocessor updated to expand defines in C code >> * update: cleaned up file structure >> * update: started working on test-suite >> * update: added grammar for C++ >> * update: build parsers via bison >> + to use in example below replace `make-lalr-machine' with >> `make-lalr-machine/bison=E2=80=99, >> after adding (use-module (nyacc bison) >> + the bison module will >> - export a bison gram.y file, >> - run "bison -x gram.y=E2=80=9D to produce a gram.xml file >> - translate gram.xml file into the nyacc =E2=80=9Cmachine=E2=80=9D = data structure >>=20 >> To run a simple demo: >> $ tar xzf nyacc-0.71.tar.gz >> $ cd examples/nyacc/lang/calc >> $ ./calc >> 2 + 2 =3D> 4 >>=20 >> Tcalc.scm: >>=20 >> (use-modules (nyacc lalr)) >> (use-modules (nyacc lex)) >> (use-modules (nyacc parse)) >>=20 >> (define simple-spec >> (lalr-spec >> (prec< (left "+" "-") (left "*" "/")) >> (start expr) >> (grammar >> (expr >> (expr "+" expr ($$ (+ $1 $3))) >> (expr "-" expr ($$ (- $1 $3))) >> (expr "*" expr ($$ (* $1 $3))) >> (expr "/" expr ($$ (/ $1 $3))) >> ($fixed ($$ (string->number $1))) >> ($float ($$ (string->number $1))) >> ("(" expr ")" ($$ $2)))))) >>=20 >> (define simple-mach (make-lalr-machine simple-spec)) >>=20 >> (define match-table (assq-ref simple-mach 'mtab)) >>=20 >> (define gen-lexer (make-lexer-generator match-table)) >>=20 >> (define parse (make-lalr-parser simple-mach)) >>=20 >> (define demo-string "2 + 2") >>=20 >> (simple-format #t "~A =3D> ~A\n" >> demo-string >> (with-input-from-string demo-string >> (lambda () (parse (gen-lexer))))) >>=20 >> download tarball from: >> http://download.savannah.gnu.org/releases/nyacc/ >> or git clone from >> git://git.savannah.nongnu.org/nyacc.git >>=20 >>=20 >>=20