guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nyacc version 0.71.0 released


From: Chaos Eternal
Subject: Re: nyacc version 0.71.0 released
Date: Tue, 21 Jun 2016 12:21:45 +0000

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
address@hidden:~/src/nyacc/examples/nyacc



On Fri, Apr 15, 2016 at 9:35 PM Matt Wette <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]