* [ANN] nyacc 0.82.0 released [not found] <EDFB9E11-6781-4F31-A654-4C644350CA4F@gmail.com> @ 2017-09-10 15:37 ` Matt Wette 2017-09-10 18:17 ` Matt Wette ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Matt Wette @ 2017-09-10 15:37 UTC (permalink / raw) To: guile-user; +Cc: guile-devel Nyacc 0.82.0 has been released In this version I have cleaned up more of the FFI Helper. Note: 1) In the distribution, you will see example .ffi files in examples/ffi/. 2) use of the FFI Helper required the bytestructures package, available from: https://github.com/TaylanUB/scheme-bytestructures 3) ffi/cairo.ffi is converted to ffi/cairo.scm by the command $ guild compile-ffi ffi/cairo.ffi 4) It works on my mac. I don't know what else: the code needs to have access to files in odd places (e.g., lib/gcc/..../include 5) If you do `make install', and have bytestructures in the SITE_SCM_DIR, then this should work: $ make install-ffi-help ... +++ warning: the FFI Helper is experimental ffi-help: can't do varargs (yet) wrote `/var/tmp/zz/scm/ffi/sqlite3.scm' wrote `/var/tmp/zz/go/ffi/sqlite3.go' +++ warning: the FFI Helper is experimental ffi-help: can't do varargs (yet) wrote `/var/tmp/zz/scm/ffi/libgit2.scm' wrote `/var/tmp/zz/go/ffi/libgit2.go' +++ warning: the FFI Helper is experimental ffi-help: can't do varargs (yet) ffi-help: no FFI float-type for "long double" wrote `/var/tmp/zz/scm/ffi/glib.scm' wrote `/var/tmp/zz/go/ffi/glib.go' ... 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] 6+ messages in thread
* Re: [ANN] nyacc 0.82.0 released 2017-09-10 15:37 ` [ANN] nyacc 0.82.0 released Matt Wette @ 2017-09-10 18:17 ` Matt Wette 2017-09-12 1:44 ` Matt Wette 2017-09-16 16:53 ` [ANN] nyacc 0.82.1 released Matt Wette 2 siblings, 0 replies; 6+ messages in thread From: Matt Wette @ 2017-09-10 18:17 UTC (permalink / raw) To: Guile User Mailing List; +Cc: guile-devel > On Sep 10, 2017, at 8:37 AM, Matt Wette <matt.wette@gmail.com> wrote: > > Nyacc 0.82.0 has been released > > In this version I have cleaned up more of the FFI Helper. Note: > 1) In the distribution, you will see example .ffi files in examples/ffi/. > 2) use of the FFI Helper required the bytestructures package, available from: > https://github.com/TaylanUB/scheme-bytestructures > 3) ffi/cairo.ffi is converted to ffi/cairo.scm by the command > $ guild compile-ffi ffi/cairo.ffi > 4) It works on my mac. I don't know what else: the code needs to have access > to files in odd places (e.g., lib/gcc/..../include > 5) If you do `make install', and have bytestructures in the SITE_SCM_DIR, then > this should work: > $ make install-ffi-help > ... > +++ warning: the FFI Helper is experimental > ffi-help: can't do varargs (yet) > wrote `/var/tmp/zz/scm/ffi/sqlite3.scm' > wrote `/var/tmp/zz/go/ffi/sqlite3.go' > +++ warning: the FFI Helper is experimental > ffi-help: can't do varargs (yet) > wrote `/var/tmp/zz/scm/ffi/libgit2.scm' > wrote `/var/tmp/zz/go/ffi/libgit2.go' > +++ warning: the FFI Helper is experimental > ffi-help: can't do varargs (yet) > ffi-help: no FFI float-type for "long double" > wrote `/var/tmp/zz/scm/ffi/glib.scm' > wrote `/var/tmp/zz/go/ffi/glib.go' Some additional notes: 6) compile-ffi and compile may take significant time. I have seen compile-ffi take time on include files that have a large number of re-includes. Nyacc does not try to skip re-reading include files (like gcc does). And compile takes a long time because the .scm files can be huge. On my machine, ffi/gio.scm turns out to be about 24 K lines and the gio.go file is 8 MB. 7) In examples I show that passing strings to function is done via (foo (string->pointer "abc")). Using string->pointer is not required: unwrap~pointer will now deal with this. 8) the FFI Helper files .scm files are distributed in SCM_DIR -- not under nyacc/ : + scripts/compile-ffi.scm is the compiler driver invoked by `guild' + system/ffi-help-rt.scm is the FFI Helper runtime (macros for defining types, etc) + ffi/ is the conventional place to host .ffi files, so ffi/glib.scm is code for (ffi glib) 9) I will need to look into how to add some needed types in guile FFI: intptr_t, long long, long double. Matt ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ANN] nyacc 0.82.0 released 2017-09-10 15:37 ` [ANN] nyacc 0.82.0 released Matt Wette 2017-09-10 18:17 ` Matt Wette @ 2017-09-12 1:44 ` Matt Wette 2017-09-16 16:53 ` [ANN] nyacc 0.82.1 released Matt Wette 2 siblings, 0 replies; 6+ messages in thread From: Matt Wette @ 2017-09-12 1:44 UTC (permalink / raw) To: Matt Wette; +Cc: guile-user, guile-devel > On Sep 10, 2017, at 8:37 AM, Matt Wette <matt.wette@gmail.com> wrote: > > Nyacc 0.82.0 has been released Appologies if you have tried this and running into problems. I found a few bugs. I have been working on macos but now trying on Centos system. I will release a minor update by end of the coming weekend. The patch below should help you get by for now. -- Matt diff --git a/examples/nyacc/lang/c99/ffi-help.scm b/examples/nyacc/lang/c99/ffi-help.scm index a9ec063..f4a2221 100644 --- a/examples/nyacc/lang/c99/ffi-help.scm +++ b/examples/nyacc/lang/c99/ffi-help.scm @@ -19,6 +19,8 @@ ;; bytestructure->descriptor->ffi-descriptor ;; bs:pointer->proc +;; For enum typedefs we are not creating types but just using wrappers. + (define-module (nyacc lang c99 ffi-help) #:export (*ffi-help-version* define-ffi-module @@ -73,7 +75,7 @@ "__attribute__(X)=" "__inline=" "__inline__=" "__asm(X)=" "__asm__(X)=" - "__has_include=(X)__has_include__(X)" + "__has_include(X)=__has_include__(X)" "__extension__=" ) ;;("sys/cdefs.h" "__DARWIN_ALIAS(X)=") @@ -82,9 +84,10 @@ '(("__builtin" "__builtin_va_list=void*" "__attribute__(X)=" "__inline=" "__inline__=" - "__asm(X)=" "__asm__(X)=") - "__has_include=(X)__has_include__(X)" + "__asm(X)=" "__asm__(X)=" + "__has_include(X)=__has_include__(X)" "__extension__=" + ) )))) (define fh-cpp-defs (cond @@ -753,7 +756,9 @@ (define (gen-exec-params params) (fold-right (lambda (param-decl seed) - (let* ((param-decl (expand-typerefs param-decl (*udict*) (*defined*))) + ;; Changed to (*wrapped*) to include enum types. If we need (*defined*) + ;; then we will need to create enum types in cnvt-udecl typedefs. + (let* ((param-decl (expand-typerefs param-decl (*udict*) (*wrapped*))) (param-decl (udecl-rem-type-qual param-decl)) ;; ??? (mspec (udecl->mspec param-decl))) (acons (car mspec) (mspec->fh-unwrapper mspec) seed))) @@ -798,27 +803,6 @@ ;; specl is decl-spec-list tree ;; params is list of param-decl trees (i.e., cdr of param-list tree) ;; @end deffn -(define (OLD-cnvt-fctn name rdecl params) - #;(when (string=? name "gdbm_store") (sfout "cnvt-fctn\n") (ppout params)) - (let* ((decl-return (gen-decl-return rdecl)) - (decl-params (gen-decl-params params)) - (exec-return (gen-exec-return-wrapper rdecl)) - (exec-params (gen-exec-params params))) - (when #f - (sfout "cnvt-fctn\n") (ppout params) - (ppout decl-params) (ppout exec-params)) - (ppscm - `(define ,(string->symbol name) - (let ((~f #f)) - (lambda ,(gen-exec-arg-names exec-params) - (unless ~f - (set! ~f (fh-link-proc - ,name ,decl-return (list ,@decl-params)))) - (let ,(gen-exec-unwrappers exec-params) - ,(if exec-return - `(,exec-return (~f ,@(gen-exec-call-args exec-params))) - `(~f ,@(gen-exec-call-args exec-params)))))))) - (sfscm "(export ~A)\n" name))) (define (cnvt-fctn name rdecl params) (let* ((decl-return (gen-decl-return rdecl)) (decl-params (gen-decl-params params)) diff --git a/examples/system/ffi-help-rt.scm b/examples/system/ffi-help-rt.scm index 80f0382..9550ac7 100644 --- a/examples/system/ffi-help-rt.scm +++ b/examples/system/ffi-help-rt.scm @@ -194,7 +194,7 @@ (make-fht (quote type) unwrap #f #f (make-bs*-printer (quote type)))) (define (wrap val) ;; pointer returned from code - (make (bytestructure type val))) + (make (bytestructure desc (ffi:pointer-address val)))) (export make type? unwrap type wrap) ))) @@ -353,7 +353,7 @@ (define (unwrap~pointer obj) (cond ((ffi:pointer? obj) obj) - ((string? obj) (string->pointer obj)) + ((string? obj) (ffi:string->pointer obj)) ((bytestructure? obj) (ffi:make-pointer (bytestructure-ref obj))) ((fh-object? obj) (unwrap~pointer (struct-ref obj 0))) (else (error "expecting pointer type")))) ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [ANN] nyacc 0.82.1 released 2017-09-10 15:37 ` [ANN] nyacc 0.82.0 released Matt Wette 2017-09-10 18:17 ` Matt Wette 2017-09-12 1:44 ` Matt Wette @ 2017-09-16 16:53 ` Matt Wette 2017-11-11 14:27 ` Jan Nieuwenhuizen 2 siblings, 1 reply; 6+ messages in thread From: Matt Wette @ 2017-09-16 16:53 UTC (permalink / raw) To: guile-devel; +Cc: Guile User Mailing List Nyacc 0.82.1 has been released. This is a fix to 0.82.0, which has issues with running the FFI helper. I can now run the cairo ffi helper demo on Centos. To run the ffi helper cairo demo, check the file HACKING in the distribution. 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] 6+ messages in thread
* Re: [ANN] nyacc 0.82.1 released 2017-09-16 16:53 ` [ANN] nyacc 0.82.1 released Matt Wette @ 2017-11-11 14:27 ` Jan Nieuwenhuizen 2017-11-11 15:22 ` Matt Wette 0 siblings, 1 reply; 6+ messages in thread From: Jan Nieuwenhuizen @ 2017-11-11 14:27 UTC (permalink / raw) To: Matt Wette; +Cc: Guile User Mailing List, guile-devel [-- Attachment #1: Type: text/plain, Size: 971 bytes --] Matt Wette writes: Hey Matt, > Nyacc 0.82.1 has been released. Congrats! It's been a while but in 0.82.0 I found a regression of a bug that you fixed earlier, I think in 0.80.4 https://lists.gnu.org/archive/html/guile-user/2017-06/msg00003.html I've attached the problematic file again. It's also still present in 0.82.1 $ 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.82.1" scheme@(guile-user)> (use-modules (nyacc lang c99 parser)) scheme@(guile-user)> (with-input-from-file "def-bwl.c" parse-c99) (unknown):1: parse failed at state 89, on input "DEF_BWL" (unknown):1: C99 parse error $2 = #f Greetings, janneke [-- Attachment #2: def-bwl.c --] [-- Type: application/octet-stream, Size: 528 bytes --] #define DEF_BWL(x) \ DEF(TOK_ASM_ ## x ## b, #x "b") \ DEF(TOK_ASM_ ## x ## w, #x "w") \ DEF(TOK_ASM_ ## x ## l, #x "l") \ DEF(TOK_ASM_ ## x, #x) #if 1 // !__MESC__ #define DEF_BWLX DEF_BWL #else // Workaround for Nyacc #define DEF_BWLX(x) \ DEF(TOK_ASM_ ## x ## b, #x "b") \ DEF(TOK_ASM_ ## x ## w, #x "w") \ DEF(TOK_ASM_ ## x ## l, #x "l") \ DEF(TOK_ASM_ ## x, #x) #endif enum tcc_token { TOK_LAST #define DEF(id, str) ,id DEF_BWLX(mov) #undef DEF }; int main (int argc, char *argv[]) { return TOK_ASM_mov; } [-- Attachment #3: 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 [flat|nested] 6+ messages in thread
* Re: [ANN] nyacc 0.82.1 released 2017-11-11 14:27 ` Jan Nieuwenhuizen @ 2017-11-11 15:22 ` Matt Wette 0 siblings, 0 replies; 6+ messages in thread From: Matt Wette @ 2017-11-11 15:22 UTC (permalink / raw) To: Jan Nieuwenhuizen; +Cc: Guile User Mailing List, guile-devel [-- Attachment #1: Type: text/plain, Size: 1235 bytes --] > On Nov 11, 2017, at 6:27 AM, Jan Nieuwenhuizen <janneke@gnu.org> wrote: > > Matt Wette writes: > > Hey Matt, > >> Nyacc 0.82.1 has been released. > > Congrats! > > It's been a while but in 0.82.0 I found a regression of a bug that you > fixed earlier, I think in 0.80.4 > > https://lists.gnu.org/archive/html/guile-user/2017-06/msg00003.html > > I've attached the problematic file again. It's also still present in 0.82.1 > > $ 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.82.1" > scheme@(guile-user)> (use-modules (nyacc lang c99 parser)) > scheme@(guile-user)> (with-input-from-file "def-bwl.c" parse-c99) > (unknown):1: parse failed at state 89, on input "DEF_BWL" > (unknown):1: C99 parse error > $2 = #f Ugh. I thought I had that one. I will take a look PASS: nyacc/c99-01, CPP: #, ##, __VA_ARGS__ [-- Attachment #2: Type: text/html, Size: 2961 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-11 15:22 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <EDFB9E11-6781-4F31-A654-4C644350CA4F@gmail.com> 2017-09-10 15:37 ` [ANN] nyacc 0.82.0 released Matt Wette 2017-09-10 18:17 ` Matt Wette 2017-09-12 1:44 ` Matt Wette 2017-09-16 16:53 ` [ANN] nyacc 0.82.1 released Matt Wette 2017-11-11 14:27 ` Jan Nieuwenhuizen 2017-11-11 15:22 ` 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).