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: nyacc version 0.71.0 released Date: Thu, 14 Apr 2016 18:47:05 -0700 Message-ID: <41775BE0-4A4E-469E-9550-7FD4E47481BE@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_056D42CD-2F35-4151-8D37-6FD988B1D8C8" X-Trace: ger.gmane.org 1460727376 9243 80.91.229.3 (15 Apr 2016 13:36:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Apr 2016 13:36:16 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Apr 15 15:36:03 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 1ar3ul-0008U6-Hv for guile-user@m.gmane.org; Fri, 15 Apr 2016 15:36:03 +0200 Original-Received: from localhost ([::1]:34316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar3ug-0003vd-0a for guile-user@m.gmane.org; Fri, 15 Apr 2016 09:35:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqsqn-0003lY-2d for guile-user@gnu.org; Thu, 14 Apr 2016 21:47:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqsqj-0001Yy-P1 for guile-user@gnu.org; Thu, 14 Apr 2016 21:47:13 -0400 Original-Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]:34893) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqsqj-0001YM-Ae for guile-user@gnu.org; Thu, 14 Apr 2016 21:47:09 -0400 Original-Received: by mail-pf0-x231.google.com with SMTP id n1so51597762pfn.2 for ; Thu, 14 Apr 2016 18:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:message-id:mime-version:subject:date:references:to:in-reply-to; bh=rfMl15vkQjdVdIoGkzpEiTN1qsFM8F6qCOpM9gZOcu4=; b=kYjcFXJ2umi9P+Ixfq+a5vEUIunhqf7t9s+qPXvS6PnmKnQM4YBiI4Y0oIUDM8BhYf /IwbkmEbd4WmYbZP7GSLaZ5FkP5Wb4sG+h6/d2ZGxp02My3iqb9u+jLBOBZ2DNVUGw/m NTmiNe/tTJtGiC+X0xF7fKBL7h0M0B9RA2VJA9iZnz4HY8vTokn+QUBhes7a3QALsVJM YzPE8B7/WyHFxHYpsfXUsoEnjcvuX6TKPy+JtzLvszHUmmjN/D3hmAQhu88xbY/+eWuF tNng3f/6BO6s491PcYzJcTyrl44uyHrQNUhoQHm5+HuGdeCYHjIIrYST2A/mM1XBxExt 0CVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:mime-version:subject:date :references:to:in-reply-to; bh=rfMl15vkQjdVdIoGkzpEiTN1qsFM8F6qCOpM9gZOcu4=; b=F2X7PyJgXjIbBkPNN+/DJj6Nl3sWfmoWqHlJONBs5iqGT/yYtNDAFtbKi/Vp6oKgkH /GleOO/3LndQ4jbnIjQlKsHSFaGKVCvo2Eh4x7GkV6ZNlNRhscXi4ee8hAq4OyIKvt0b LZZ7/T56u1Vnj8nPwZEA7Izkw5jCbjctf83dvvDzNzp2Qq1geKReo328HkJMdZx3ta/c bH0uGKEIrhqD0/bRUVUFVD/mEuRJ84vfhwtemNGVu71MsfOPhzyyQrcR9O8OSFVWZ5bq a+XyCt1ljROe/STWa5iKvpoPFzfhjmpwaG5uGJTene8mSc3Boa0vOUAgwfD7akCSNC9/ sFpg== X-Gm-Message-State: AOPr4FVOL76+tMHIqOQHVlRhW6g6eF96E4NRRn5GrKK9gISDN8PEcWixED5uvM/Qzn6png== X-Received: by 10.98.72.218 with SMTP id q87mr25843678pfi.117.1460684827748; Thu, 14 Apr 2016 18:47:07 -0700 (PDT) Original-Received: from nautilus.championbroadband.com (216-165-226-173.championbroadband.com. [216.165.226.173]) by smtp.gmail.com with ESMTPSA id ke7sm45127233pad.44.2016.04.14.18.47.06 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Apr 2016 18:47:06 -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:c00::231 X-Mailman-Approved-At: Fri, 15 Apr 2016 09:35:40 -0400 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:12548 Archived-At: --Apple-Mail=_056D42CD-2F35-4151-8D37-6FD988B1D8C8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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=E2=80=99, after adding (use-module (nyacc bison) + the bison module will=20 - export a bison gram.y file,=20 - 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 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 =3D> ~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 = --Apple-Mail=_056D42CD-2F35-4151-8D37-6FD988B1D8C8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 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=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
  
To run a simple demo:
$ tar xzf = nyacc-0.71.tar.gz
$ cd = examples/nyacc/lang/calc
$ ./calc
2 + 2 =3D> 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 =3D> ~A\n"
  =     demo-string
      = (with-input-from-string demo-string
(lambda () (parse = (gen-lexer)))))

download tarball from:
or git clone from


= --Apple-Mail=_056D42CD-2F35-4151-8D37-6FD988B1D8C8--