* [ANN] nyacc 0.80.4 released
@ 2017-07-28 23:47 Matt Wette
2017-08-01 20:53 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 8+ messages in thread
From: Matt Wette @ 2017-07-28 23:47 UTC (permalink / raw)
To: Guile User
NYACC version 0.80.4 is released
This is a bug-fix release, to fix several bugs discovered by janneke. Thanks Jan.
1) C parser not parsing “0ULL” as numeric; fixed.
2) #undef FOO not working; fixed;
3) struct foo { …} => (struct-def (ident (“foo”))… ; fixed: => (struct-def (ident “foo”) …
4) C pre-processor argument reading dropping characters
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
tarball repository:
https://download.savannah.gnu.org/releases/nyacc/
git repository:
git://git.savannah.nongnu.org/nyacc.git
home page, project page, 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ANN] nyacc 0.80.4 released
2017-07-28 23:47 [ANN] nyacc 0.80.4 released Matt Wette
@ 2017-08-01 20:53 ` Jan Nieuwenhuizen
2017-08-01 23:10 ` Matt Wette
0 siblings, 1 reply; 8+ messages in thread
From: Jan Nieuwenhuizen @ 2017-08-01 20:53 UTC (permalink / raw)
To: Matt Wette; +Cc: Guile User
[-- Attachment #1: Type: text/plain, Size: 972 bytes --]
Matt Wette writes:
> NYACC version 0.80.4 is released
>
> This is a bug-fix release, to fix several bugs discovered by janneke. Thanks Jan.
> 1) C parser not parsing “0ULL” as numeric; fixed.
> 2) #undef FOO not working; fixed;
> 3) struct foo { …} => (struct-def (ident (“foo”))… ; fixed: => (struct-def (ident “foo”) …
> 4) C pre-processor argument reading dropping characters
Yay, thanks again!
Meanwhile, rain1 and I found two bugs. First is not really a bug, debug
printing while parsing \xXX. Do
(with-input-from-file "x00.c" parse-c99)
with x00.c:
char *s = "\x66\x6f\x6f\x20";
see patch attached.
The others is parsing of "\0", see null.c. Instead of a null character
(or possibly literally "\0") we get an ascii 0 (without backslash).
Not sure what we want here, if "\0" passes through literally, the
compiler will need to parse strings again and change those to null?
Greetings,
janneke
[-- Attachment #2: x00.c --]
[-- Type: application/octet-stream, Size: 59 bytes --]
char *s = "\x66\x6f\x6f\x20";
int
main ()
{
puts (s);
}
[-- Attachment #3: 0001-typo-fix-parsing-of-xXX.patch --]
[-- Type: text/x-patch, Size: 937 bytes --]
From aa97207497b1d290734d04accf019caa4e854796 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Tue, 1 Aug 2017 19:39:25 +0200
Subject: [PATCH] typo: fix parsing of \xXX
* module/nyacc/lex.scm (read-hex): Comment-out debug printing.
---
module/nyacc/lex.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/module/nyacc/lex.scm b/module/nyacc/lex.scm
index 2a4d28a..3636738 100644
--- a/module/nyacc/lex.scm
+++ b/module/nyacc/lex.scm
@@ -206,7 +206,7 @@
(cs:lhx (string->char-set "abcdef")))
(lambda (ch) ;; ch == #\x always
(let iter ((cv 0) (ch (read-char)) (n 0))
- (simple-format #t "ch=~S\n" ch)
+ ;;(simple-format #t "ch=~S\n" ch)
(cond
((eof-object? ch) cv)
((> n 2) (unread-char ch) cv)
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
[-- Attachment #4: null.c --]
[-- Type: application/octet-stream, Size: 24 bytes --]
char *s = "foo\0bar";
[-- Attachment #5: 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] 8+ messages in thread
* Re: [ANN] nyacc 0.80.4 released
2017-08-01 20:53 ` Jan Nieuwenhuizen
@ 2017-08-01 23:10 ` Matt Wette
2017-08-02 5:23 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 8+ messages in thread
From: Matt Wette @ 2017-08-01 23:10 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: Guile User
> On Aug 1, 2017, at 1:53 PM, Jan Nieuwenhuizen <janneke@gnu.org> wrote:
>
> Matt Wette writes:
>
>> NYACC version 0.80.4 is released
>>
>> This is a bug-fix release, to fix several bugs discovered by janneke. Thanks Jan.
>> 1) C parser not parsing “0ULL” as numeric; fixed.
>> 2) #undef FOO not working; fixed;
>> 3) struct foo { …} => (struct-def (ident (“foo”))… ; fixed: => (struct-def (ident “foo”) …
>> 4) C pre-processor argument reading dropping characters
>
> Yay, thanks again!
Thanks for the reports. I am happy to see the severity in bugs reducing.
For the FFI-helper I need to parse the rat’s nest under /usr/include so I am catching more.
>
> Meanwhile, rain1 and I found two bugs. First is not really a bug, debug
> printing while parsing \xXX. Do
>
> (with-input-from-file "x00.c" parse-c99)
>
> with x00.c:
>
> char *s = "\x66\x6f\x6f\x20";
>
> see patch attached.
>
> The others is parsing of "\0", see null.c. Instead of a null character
> (or possibly literally "\0") we get an ascii 0 (without backslash).
>
> Not sure what we want here, if "\0" passes through literally, the
> compiler will need to parse strings again and change those to null?
I am not sure what you are getting at here. If I have
char *s = “foo\0bar”;
then the tree is
(trans-unit
(decl (decl-spec-list (type-spec (fixed-type "char")))
(init-declr-list
(init-declr
(ptr-declr (pointer) (ident "s"))
(initzer (p-expr (string "foo\x00bar")))))))
so the null character makes it into the tree. The tree language is SXML so this should be a
legal Scheme string, which I think it is. See http://dl.acm.org/citation.cfm?doid=571727.571736.
On the other hand, the C99 pretty-printer turns out
char *s = "foo\x00bar”;
which is wrong. I will work on something to make this look like “foo\0bar”.
Look for fixes to above, along with some (minor) changes in c99 output, in 0.81.0.
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ANN] nyacc 0.80.4 released
2017-08-01 23:10 ` Matt Wette
@ 2017-08-02 5:23 ` Jan Nieuwenhuizen
2017-08-02 12:13 ` Matt Wette
2017-08-04 17:38 ` Matt Wette
0 siblings, 2 replies; 8+ messages in thread
From: Jan Nieuwenhuizen @ 2017-08-02 5:23 UTC (permalink / raw)
To: Matt Wette; +Cc: Guile User
Matt Wette writes:
> Thanks for the reports. I am happy to see the severity in bugs reducing.
Yes!
> For the FFI-helper I need to parse the rat’s nest under /usr/include
> so I am catching more.
Hah :-)
> I am not sure what you are getting at here. If I have
> char *s = “foo\0bar”;
> then the tree is
> (trans-unit
> (decl (decl-spec-list (type-spec (fixed-type "char")))
> (init-declr-list
> (init-declr
> (ptr-declr (pointer) (ident "s"))
> (initzer (p-expr (string "foo\x00bar")))))))
> so the null character makes it into the tree. The tree language is SXML so this should be a
> legal Scheme string, which I think it is. See http://dl.acm.org/citation.cfm?doid=571727.571736.
Hmm, weird are you using my null.c? Here's what I get
--8<---------------cut here---------------start------------->8---
07:18:50 janneke@dundal:~/src/nyacc [env]
$ guile
GNU Guile 2.2.2
Copyright (C) 1995-2017 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (use-modules (nyacc lalr))
scheme@(guile-user)> *nyacc-version*
$1 = "0.80.4"
scheme@(guile-user)> (use-modules (nyacc lang c99 parser))
scheme@(guile-user)> (with-input-from-file "null.c" parse-c99)
$2 = (trans-unit (decl (decl-spec-list (type-spec (fixed-type "char"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "s")) (initzer (p-expr (string "foo0bar")))))))
scheme@(guile-user)>
--8<---------------cut here---------------end--------------->8---
> Look for fixes to above, along with some (minor) changes in c99 output, in 0.81.0.
Thanks!
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] 8+ messages in thread
* Re: [ANN] nyacc 0.80.4 released
2017-08-02 5:23 ` Jan Nieuwenhuizen
@ 2017-08-02 12:13 ` Matt Wette
2017-08-02 12:22 ` Matt Wette
2017-08-04 17:38 ` Matt Wette
1 sibling, 1 reply; 8+ messages in thread
From: Matt Wette @ 2017-08-02 12:13 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: Guile User
> On Aug 1, 2017, at 10:23 PM, Jan Nieuwenhuizen <janneke@gnu.org> wrote:
>
> Matt Wette writes:
>
>> Thanks for the reports. I am happy to see the severity in bugs reducing.
>
> Yes!
>
>> For the FFI-helper I need to parse the rat’s nest under /usr/include
>> so I am catching more.
>
> Hah :-)
>
>> I am not sure what you are getting at here. If I have
>> char *s = “foo\0bar”;
>> then the tree is
>> (trans-unit
>> (decl (decl-spec-list (type-spec (fixed-type "char")))
>> (init-declr-list
>> (init-declr
>> (ptr-declr (pointer) (ident "s"))
>> (initzer (p-expr (string "foo\x00bar")))))))
>> so the null character makes it into the tree. The tree language is SXML so this should be a
>> legal Scheme string, which I think it is. See http://dl.acm.org/citation.cfm?doid=571727.571736.
>
> Hmm, weird are you using my null.c? Here's what I get
>
> --8<---------------cut here---------------start------------->8---
> 07:18:50 janneke@dundal:~/src/nyacc [env]
> $ guile
> GNU Guile 2.2.2
> Copyright (C) 1995-2017 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (use-modules (nyacc lalr))
> scheme@(guile-user)> *nyacc-version*
> $1 = "0.80.4"
> scheme@(guile-user)> (use-modules (nyacc lang c99 parser))
> scheme@(guile-user)> (with-input-from-file "null.c" parse-c99)
> $2 = (trans-unit (decl (decl-spec-list (type-spec (fixed-type "char"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "s")) (initzer (p-expr (string "foo0bar")))))))
> scheme@(guile-user)>
> --8<---------------cut here---------------end--------------->8---
>
>
>> Look for fixes to above, along with some (minor) changes in c99 output, in 0.81.0.
>
> Thanks!
>
> Greetings,
> janneke
>
> --
> Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
> Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com <http://avataracademy.com/>
You are right. If I use the string parser it parses correctly. If I use the file parser it does not.
I need to check this out.
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ANN] nyacc 0.80.4 released
2017-08-02 12:13 ` Matt Wette
@ 2017-08-02 12:22 ` Matt Wette
2017-08-04 10:31 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 8+ messages in thread
From: Matt Wette @ 2017-08-02 12:22 UTC (permalink / raw)
To: Matt Wette; +Cc: Guile User
> On Aug 2, 2017, at 5:13 AM, Matt Wette <matt.wette@gmail.com> wrote:
>
>
>> On Aug 1, 2017, at 10:23 PM, Jan Nieuwenhuizen <janneke@gnu.org> wrote:
>>
>> Matt Wette writes:
>>
>>> Thanks for the reports. I am happy to see the severity in bugs reducing.
>>
>> Yes!
>>
>>> For the FFI-helper I need to parse the rat’s nest under /usr/include
>>> so I am catching more.
>>
>> Hah :-)
>>
>>> I am not sure what you are getting at here. If I have
>>> char *s = “foo\0bar”;
>>> then the tree is
>>> (trans-unit
>>> (decl (decl-spec-list (type-spec (fixed-type "char")))
>>> (init-declr-list
>>> (init-declr
>>> (ptr-declr (pointer) (ident "s"))
>>> (initzer (p-expr (string "foo\x00bar")))))))
>>> so the null character makes it into the tree. The tree language is SXML so this should be a
>>> legal Scheme string, which I think it is. See http://dl.acm.org/citation.cfm?doid=571727.571736.
>>
>> Hmm, weird are you using my null.c? Here's what I get
>>
>> --8<---------------cut here---------------start------------->8---
>> 07:18:50 janneke@dundal:~/src/nyacc [env]
>> $ guile
>> GNU Guile 2.2.2
>> Copyright (C) 1995-2017 Free Software Foundation, Inc.
>>
>> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
>> This program is free software, and you are welcome to redistribute it
>> under certain conditions; type `,show c' for details.
>>
>> Enter `,help' for help.
>> scheme@(guile-user)> (use-modules (nyacc lalr))
>> scheme@(guile-user)> *nyacc-version*
>> $1 = "0.80.4"
>> scheme@(guile-user)> (use-modules (nyacc lang c99 parser))
>> scheme@(guile-user)> (with-input-from-file "null.c" parse-c99)
>> $2 = (trans-unit (decl (decl-spec-list (type-spec (fixed-type "char"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "s")) (initzer (p-expr (string "foo0bar")))))))
>> scheme@(guile-user)>
>> --8<---------------cut here---------------end--------------->8---
>>
>>
>>> Look for fixes to above, along with some (minor) changes in c99 output, in 0.81.0.
>>
>> Thanks!
>>
>> Greetings,
>> janneke
>>
>> --
>> Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
>> Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com <http://avataracademy.com/>
>
> You are right. If I use the string parser it parses correctly. If I use the file parser it does not.
> I need to check this out.
And I found it. Thanks. — Mtt
@@ -244,8 +244,8 @@
((#\v) (cons #\vtab cl))
((#\x) (cons (integer->char (read-hex ch)) cl))
(else
- (if (char-numeric? ch)
- (cons (integer->char (read-oct ch)) cl)
+ (if (char-numeric? c1)
+ (cons (integer->char (read-oct c1)) cl)
(cons c1 cl))))
(read-char))))
((eq? ch #\") (cons '$string (lxlsr cl)))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ANN] nyacc 0.80.4 released
2017-08-02 12:22 ` Matt Wette
@ 2017-08-04 10:31 ` Jan Nieuwenhuizen
0 siblings, 0 replies; 8+ messages in thread
From: Jan Nieuwenhuizen @ 2017-08-04 10:31 UTC (permalink / raw)
To: Matt Wette; +Cc: Guile User
Matt Wette writes:
>> You are right. If I use the string parser it parses correctly. If I use the file parser it does not.
>> I need to check this out.
>
> And I found it. Thanks. — Mtt
>
> @@ -244,8 +244,8 @@
> ((#\v) (cons #\vtab cl))
> ((#\x) (cons (integer->char (read-hex ch)) cl))
> (else
> - (if (char-numeric? ch)
> - (cons (integer->char (read-oct ch)) cl)
> + (if (char-numeric? c1)
> + (cons (integer->char (read-oct c1)) cl)
> (cons c1 cl))))
> (read-char))))
> ((eq? ch #\") (cons '$string (lxlsr cl)))
Oh, nice and honest bug :-)
Thanks! Applied locally; switched to 0.80.4+ patches now which gives
good tcc progress.
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] 8+ messages in thread
* Re: [ANN] nyacc 0.80.4 released
2017-08-02 5:23 ` Jan Nieuwenhuizen
2017-08-02 12:13 ` Matt Wette
@ 2017-08-04 17:38 ` Matt Wette
1 sibling, 0 replies; 8+ messages in thread
From: Matt Wette @ 2017-08-04 17:38 UTC (permalink / raw)
To: Guile User
> On Aug 1, 2017, at 10:23 PM, Jan Nieuwenhuizen <janneke@gnu.org> wrote:
>
> Matt Wette writes:
>> For the FFI-helper I need to parse the rat’s nest under /usr/include
>> so I am catching more.
>
> Hah :-)
So I decided I should probably implement `__has_include' and `__has_include_next' (as well as `include_next').
So one more dive into the C preprocessor. I have it working for <stdio.h> but “foo.h” is giving me a
little trouble for some unknown reason.
I have also added `asm' syntax in expression context but not in declaration context (as used in macOS).
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-08-04 17:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-28 23:47 [ANN] nyacc 0.80.4 released Matt Wette
2017-08-01 20:53 ` Jan Nieuwenhuizen
2017-08-01 23:10 ` Matt Wette
2017-08-02 5:23 ` Jan Nieuwenhuizen
2017-08-02 12:13 ` Matt Wette
2017-08-02 12:22 ` Matt Wette
2017-08-04 10:31 ` Jan Nieuwenhuizen
2017-08-04 17:38 ` Matt Wette
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).