unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: Chaos Eternal <chaoseternal@shlug.org>
Cc: guile-user@gnu.org
Subject: Re: nyacc version 0.71.0 released
Date: Tue, 21 Jun 2016 05:55:06 -0700	[thread overview]
Message-ID: <71C39F15-427D-4043-97E7-F0593CE8EDC3@gmail.com> (raw)
In-Reply-To: <CAGyY8NsyvAmBOqs0WeJ4JQRfi3DBjX8B=kbnPfxG0h9dVMX4bA@mail.gmail.com>

Like I said: “beta code."  It’s 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 <chaoseternal@shlug.org> wrote:
> 
> Hi,
> 
> I met with this message when I want to parse UnixODBC's header file:
> but guile version is 2.0.11
> 
> $ ./cxp -Ilang/c99/ -I/usr/include /usr/include/sql.h
> Backtrace:
> In ice-9/boot-9.scm:
> 4052: 19 [#<procedure 23f4a00 at ice-9/boot-9.scm:4045:3 ()>]
> In unknown file:
>   ?: 18 [load-compiled/vm
> "/home/chaos/.cache/guile/ccache/2.0-LE-8-2.0/home/chaos/src/nyacc/examples/nyacc/cxp.go"]
> In ice-9/boot-9.scm:
> 768: 17 [for-each #<procedure 2a056c0 at
> /home/chaos/src/nyacc/examples/nyacc/./cxp:52:3 (file)> ...]
> In /home/chaos/src/nyacc/examples/nyacc/./cxp:
>  53: 16 [#<procedure 2a056c0 at
> /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 #<variable 2a0cc00 value: #<input: file
> /dev/pts/3>> ...]
> In ice-9/boot-9.scm:
> 157: 13 [catch parse-error ...]
> In unknown file:
>   ?: 12 [with-fluid* #<fluid 22> # ...]
> In ../../../../module/nyacc/parse.scm:
> 120: 11 [#<procedure 219c540 at ../../../../module/nyacc/parse.scm:97:4
> (lexr #:key debug)> #<procedure 221d080 at
> /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 [#<procedure 221d080 at
> /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 #<variable 2a19410 value: #<input:
> /usr/include/sql.h 5>> ...]
> In ../../../../module/nyacc/parse.scm:
> 120: 5 [#<procedure 219c540 at ../../../../module/nyacc/parse.scm:97:4
> (lexr #:key debug)> #<procedure 221d000 at
> /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 [#<procedure 221d000 at
> /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/body.scm:246:8
> ()>]
> 349: 3 [read-token]
> 294: 2 [exec-cpp "if (ODBCVER >= 0x0300)"]
> In ice-9/boot-9.scm:
> 157: 1 [catch error ...]
> In
> /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.scm:
>  69: 0 [eval-expr (ge (ident "ODBCVER") (fixed "0x0300"))]
> 
> /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.scm:69:22:
> In procedure eval-expr:
> /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.scm:69:22:
> In procedure >=: Wrong type argument in position 1: #f
> chaos@florrum:~/src/nyacc/examples/nyacc
> 
> 
> 
> On Fri, Apr 15, 2016 at 9:35 PM Matt Wette <matt.wette@gmail.com> wrote:
> 
>> nyacc version 0.71.0 is released as beta
>> 
>> nyacc is a LALR parser generator written from the ground up in guile
>> 
>> 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’,
>>     after adding (use-module (nyacc bison)
>>  + the bison module will
>>     - export a bison gram.y file,
>>     - run "bison -x gram.y” to produce a gram.xml file
>>     - translate gram.xml file into the nyacc “machine” data structure
>> 
>> To run a simple demo:
>> $ tar xzf nyacc-0.71.tar.gz
>> $ cd examples/nyacc/lang/calc
>> $ ./calc
>> 2 + 2 => 4
>> 
>> Tcalc.scm:
>> 
>> (use-modules (nyacc lalr))
>> (use-modules (nyacc lex))
>> (use-modules (nyacc parse))
>> 
>> (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))))))
>> 
>> (define simple-mach (make-lalr-machine simple-spec))
>> 
>> (define match-table (assq-ref simple-mach 'mtab))
>> 
>> (define gen-lexer (make-lexer-generator match-table))
>> 
>> (define parse (make-lalr-parser simple-mach))
>> 
>> (define demo-string "2 + 2")
>> 
>> (simple-format #t "~A => ~A\n"
>>      demo-string
>>      (with-input-from-string demo-string
>> (lambda () (parse (gen-lexer)))))
>> 
>> download tarball from:
>> http://download.savannah.gnu.org/releases/nyacc/
>> or git clone from
>> git://git.savannah.nongnu.org/nyacc.git
>> 
>> 
>> 




  reply	other threads:[~2016-06-21 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04 20:49 NYACC version 0.70.0 released Matt Wette
2016-04-15  1:47 ` nyacc version 0.71.0 released Matt Wette
2016-06-21 12:21   ` Chaos Eternal
2016-06-21 12:55     ` Matt Wette [this message]
2016-06-21 13:21     ` Matt Wette
2016-06-21 14:55   ` Ludovic Courtès
2016-06-21 18:12     ` Matt Wette
2016-06-22  7:34       ` Chaos Eternal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71C39F15-427D-4043-97E7-F0593CE8EDC3@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=chaoseternal@shlug.org \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).