* [ANN] Nyacc version 0.83.0 released
@ 2018-01-21 18:19 Matt Wette
2018-04-06 12:38 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 5+ messages in thread
From: Matt Wette @ 2018-01-21 18:19 UTC (permalink / raw)
To: guile-user
Nyacc version 0.83.0 has been released. Nyacc is a set of Guile
modules for generating parsers,
parsing C code, and converting C headers to Guile Scheme.
Version 0.83.0 includes the following changes over version 0.82.4:
1) changes to nyacc/lex.scm to read octal constants
2) change in C99 parser to allow lone `;' in structs and unions
3) fixed but in C99 parser which was truncating long CPP defines
4) change in C99 parser to make get-gcc-inc-dirs more accurate
5) updated C99 pretty printer to handle initializer lists
6) many changes to the ffi-helper
Some FFI Helper changes:
1) many code updates, api changes, etc
2) updates to the documentation (see examples/nyacc/lang/c99/ffi-help.texi)
3) added procedure "load-include-file", which is feature Ludo asked for:
guile> (load-include-file "cairo.h" #:pkg-config "cairo")
This will load FFIs for all C declarations in cairo.h into the
current module.
Not flushed out.
4) added procedure "fh-cnvt-cdecl" for playing around with the FH.
guile> (use-modules (nyacc lang c99 ffi-help))
guile> (use-modules (bytestructures guile))
guile> (use-modules (system ffi-help-rt))
guile> (use-modules ((system foreign) #:prefix ffi:))
guile> (define fh-llibs '())
guile> (define fexp (fh-cnvt-cdecl "fmod" "double fmod(double
x,double y);")
guile> ,pp exp
$1 = (begin
(define ~fmod
(delay (fh-link-proc
ffi:double
"fmod"
(list ffi:double ffi:double)
fh-llibs)))
(define (fmod x y)
(let ((~x (unwrap~float x)) (~y (unwrap~float y)))
((force ~fmod) ~x ~y)))
(export fmod))
guile> (eval exp (current-module))
guile> (fmod 2.3 0.5)
$2 = 0.2999999999999998
NYACC, for Not Yet Another Compiler Compiler!, is set of guile modules for
generating parsers and lexical analyzers. It also provides sample parsers
and pretty-printers using SXML trees as an intermediate representation.
NYACC maturity is beta level.
NYACC is free software; the full source distribution is available through
* the tarball repository:
https://download.savannah.gnu.org/releases/nyacc/
* the git repository:
git://git.savannah.nongnu.org/nyacc.git
home page, project page and user's guide:
* http://www.nongnu.org/nyacc
* https://savannah.nongnu.org/projects/nyacc
* http://www.nongnu.org/nyacc/nyacc-ug.html
For support see:
https://savannah.nongnu.org/support/?group=nyacc
mwette$
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ANN] Nyacc version 0.83.0 released
2018-01-21 18:19 [ANN] Nyacc version 0.83.0 released Matt Wette
@ 2018-04-06 12:38 ` Jan Nieuwenhuizen
2018-04-07 0:16 ` Matt Wette
2018-04-07 0:20 ` Matt Wette
0 siblings, 2 replies; 5+ messages in thread
From: Jan Nieuwenhuizen @ 2018-04-06 12:38 UTC (permalink / raw)
To: Matt Wette; +Cc: guile-user
[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]
Matt Wette writes:
Hey Matt,
> Nyacc version 0.83.0 has been released. Nyacc is a set of Guile
> modules for generating parsers, parsing C code, and converting C
> headers to Guile Scheme.
Very nice work.
I've not really been working on MesCC for months now, concentrating on
Mes itself to support running Nyacc and MesCC. I postponed updating
Nyacc and even reverted to using 0.80.40 (or actually my slightly
modified 0.80.42).
I finally got round to looking at it and delighted that everything
works! Two patches attached: cond-expands need to grok `mes' (or use
else instead of `guile'). Also, parsing can be still a bit slow when
running Nyacc on Mes (tcc.c now parses in ~1h); so I added some tracing
to stderr. Possibly you have a better way to do this, esp. the
NYACC_TRACE environment variable kludge...
Saw your headsup about changing struct definitions, shall I wait with my
upcomping Mes 0.12 release for that; do you already have a branch where
I can test it and change MesCC?
Greetings,
janneke
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-cond-expand-allow-mes.patch --]
[-- Type: text/x-patch, Size: 1975 bytes --]
From fbbba0435f1ddcd5020599017781c8e88443bda2 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Fri, 6 Apr 2018 14:23:45 +0200
Subject: [PATCH 1/2] cond-expand: allow mes.
---
module/nyacc/lang/util.scm | 3 ++-
module/nyacc/lex.scm | 3 ++-
module/nyacc/parse.scm | 3 ++-
module/nyacc/util.scm | 2 +-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/module/nyacc/lang/util.scm b/module/nyacc/lang/util.scm
index 3de9ee4..b617885 100644
--- a/module/nyacc/lang/util.scm
+++ b/module/nyacc/lang/util.scm
@@ -44,7 +44,8 @@
#t)
(guile
(use-modules (ice-9 optargs))
- (use-modules (srfi srfi-16))))
+ (use-modules (srfi srfi-16)))
+ (mes))
;; This is a generic copyright/licence that will be printed in the output
;; of the examples/nyacc/lang/*/ actions.scm and tables.scm files.
diff --git a/module/nyacc/lex.scm b/module/nyacc/lex.scm
index 3e5c1e3..5122856 100644
--- a/module/nyacc/lex.scm
+++ b/module/nyacc/lex.scm
@@ -59,7 +59,8 @@
(guile-2 #t)
(guile
(use-modules (ice-9 optargs))
- (use-modules (ice-9 syncase))))
+ (use-modules (ice-9 syncase)))
+ (mes))
(define (sf fmt . args) (apply simple-format #t fmt args))
diff --git a/module/nyacc/parse.scm b/module/nyacc/parse.scm
index 39ceca3..51d73cd 100644
--- a/module/nyacc/parse.scm
+++ b/module/nyacc/parse.scm
@@ -27,7 +27,8 @@
(use-modules (srfi srfi-43)))
(guile
(use-modules (ice-9 optargs))
- (use-modules (nyacc compat18))))
+ (use-modules (nyacc compat18)))
+ (mes))
;; @item (machine-hashed? mach) => #t|#f
;; Indicate if the machine has been hashed.
diff --git a/module/nyacc/util.scm b/module/nyacc/util.scm
index ed7168b..1d34449 100644
--- a/module/nyacc/util.scm
+++ b/module/nyacc/util.scm
@@ -34,7 +34,7 @@
(guile
(use-modules (ice-9 optargs))
(use-modules (nyacc compat18)))
- )
+ (mes))
(define (fmtstr fmt . args)
(apply simple-format #f fmt args))
--
2.16.2
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-trace-function-names-being-parsed.patch --]
[-- Type: text/x-patch, Size: 1702 bytes --]
From 1dd946b919ed84803e27af2697c83ffa8bafb34c Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Thu, 5 Apr 2018 21:13:13 +0200
Subject: [PATCH 2/2] trace function names being parsed.
* module/nyacc/lang/c99/mach.d/c99act.scm (trace-function)[NYACC_TRACE]: Trace function names being parsed.
(c99-act-v): Use it.
---
module/nyacc/lang/c99/mach.d/c99act.scm | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/module/nyacc/lang/c99/mach.d/c99act.scm b/module/nyacc/lang/c99/mach.d/c99act.scm
index cfbdb7f..565f9b4 100644
--- a/module/nyacc/lang/c99/mach.d/c99act.scm
+++ b/module/nyacc/lang/c99/mach.d/c99act.scm
@@ -8,6 +8,12 @@
;; version 3 of the License, or (at your option) any later version.
;; See the file COPYING.LESSER included with the this distribution.
+(define (trace-function $1)
+ (when (getenv "NYACC_TRACE")
+ (display " :" (current-error-port))
+ (display (cadr $1) (current-error-port))
+ (display "\n" (current-error-port))))
+
(define c99-act-v
(vector
;; $start => translation-unit
@@ -487,12 +493,15 @@
`(array-of ,$1 (var-len)))
;; direct-declarator => direct-declarator "(" parameter-type-list ")"
(lambda ($4 $3 $2 $1 . $rest)
+ (trace-function $1)
`(ftn-declr ,$1 ,(tl->list $3)))
;; direct-declarator => direct-declarator "(" identifier-list ")"
(lambda ($4 $3 $2 $1 . $rest)
+ (trace-function $1)
`(ftn-declr ,$1 ,(tl->list $3)))
;; direct-declarator => direct-declarator "(" ")"
(lambda ($3 $2 $1 . $rest)
+ (trace-function $1)
`(ftn-declr ,$1 (param-list)))
;; pointer => "*" type-qualifier-list pointer
(lambda ($3 $2 $1 . $rest)
--
2.16.2
[-- Attachment #4: Type: text/plain, Size: 152 bytes --]
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [ANN] Nyacc version 0.83.0 released
2018-04-06 12:38 ` Jan Nieuwenhuizen
@ 2018-04-07 0:16 ` Matt Wette
2018-04-07 0:20 ` Matt Wette
1 sibling, 0 replies; 5+ messages in thread
From: Matt Wette @ 2018-04-07 0:16 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: guile-user
On 04/06/2018 05:38 AM, Jan Nieuwenhuizen wrote:
> Hey Matt,
> I finally got round to looking at it and delighted that everything
> works! Two patches attached: cond-expands need to grok `mes' (or use
> else instead of `guile'). Also, parsing can be still a bit slow when
> running Nyacc on Mes (tcc.c now parses in ~1h); so I added some tracing
> to stderr. Possibly you have a better way to do this, esp. the
> NYACC_TRACE environment variable kludge...
I will check out your patches.
> Saw your headsup about changing struct definitions, shall I wait with my
> upcomping Mes 0.12 release for that; do you already have a branch where
> I can test it and change MesCC?
I think it will take me a while to make a release. I am in the process of
banging on this for a while. When I get to a good point I will push on
c99dev branch. I will think about creating another branch for ffi-help dev.
Matt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ANN] Nyacc version 0.83.0 released
2018-04-06 12:38 ` Jan Nieuwenhuizen
2018-04-07 0:16 ` Matt Wette
@ 2018-04-07 0:20 ` Matt Wette
2018-04-07 12:21 ` Jan Nieuwenhuizen
1 sibling, 1 reply; 5+ messages in thread
From: Matt Wette @ 2018-04-07 0:20 UTC (permalink / raw)
To: guile-user
On 04/06/2018 05:38 AM, Jan Nieuwenhuizen wrote:
> Hey Matt,
>
> I added some tracing
> to stderr. Possibly you have a better way to do this, esp. the
> NYACC_TRACE environment variable kludge...
>
There is a #:debug option to the parser that provide a trace through the
parsing.
And if you look in examples/nyacc/lang/c99/Tmach.scm there is code to
show how
to generate a file with parser states.
Matt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ANN] Nyacc version 0.83.0 released
2018-04-07 0:20 ` Matt Wette
@ 2018-04-07 12:21 ` Jan Nieuwenhuizen
0 siblings, 0 replies; 5+ messages in thread
From: Jan Nieuwenhuizen @ 2018-04-07 12:21 UTC (permalink / raw)
To: Matt Wette; +Cc: guile-user
Matt Wette writes:
> I think it will take me a while to make a release.
That's fine. Although all my tests pass, I found that to compile mes.c
I need string-fold-right. So I added that to Mes.
After that, tcc.c hangs while parsing. Will have to investigate later,
for now I'm reverting to 0.80.42.
>> I added some tracing
>> to stderr. Possibly you have a better way to do this, esp. the
>> NYACC_TRACE environment variable kludge...
>
> There is a #:debug option to the parser that provide a trace through
> the parsing.
Yes, I'm using that; great.
> And if you look in examples/nyacc/lang/c99/Tmach.scm there is code to
> show how
> to generate a file with parser states.
OK.
The NYACC_TRACE=1 feature is meant for users. Parsing tcc with
Mes+MesCC currently takes ~1h (with Guile+MesCC only 40s), so printing
some minimal feedback to the user (e.g., al functions and global
variables) is helpful.
I'll try to change my patch to use something like
#:trace '(function global)
similar to #debug.
Greetings,
janneke
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-07 12:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-21 18:19 [ANN] Nyacc version 0.83.0 released Matt Wette
2018-04-06 12:38 ` Jan Nieuwenhuizen
2018-04-07 0:16 ` Matt Wette
2018-04-07 0:20 ` Matt Wette
2018-04-07 12:21 ` Jan Nieuwenhuizen
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).