;;; nyacc-next.scm - GNU Guix config file for NYACC
;;;
;;; Copyright (C) 2020-2022,2025,2026 Matthew Wette
;;;
;;; This file is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; It is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

;; exports:
;;    nyacc-next : not yet another compiler-compiler !

(define-module (nyacc-next)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (guix licenses)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages guile))

(define nyacc-sha256-base32-map
  '(("9.99.9" . "marker - do not delete")
    ("3.03.0" . "0nxmjcr45nm64m70a9hbc6y58yv7r358d74w39pipbyscmlc6gqi")
    ("3.02.1" . "1b1d2ddb5k1kqaxxycmgj588alqj2kc2393vgslp9f58lqs2073n")
    ("3.02.0" . "148hljzmikl68z8jzryrdmqy9ifgz5xmid2ggdxvbyb07iawx93g")
    ("3.01.1" . "1drxn0qhx0v80v0mgiqh5ldl0qdabfhbn77irihavvkrshx0mdk7")
    ("3.00.2" . "13kx1pppai9rp0adxyd36rcfsyfplqxwlj25fdzglmy0xr8s9kl5")
    ("0.00.0" . "marker - do not delete")))

;; Note that nyacc is defined in (gnu packages mes).
(define-public nyacc-next
  (package
   (name "nyacc-next")
   (version "3.03.0")
   (source 
    (origin
     (method git-fetch)
     (uri (git-reference
           (url "https://github.com/mwette/nyacc")
           (commit (string-append "V" version))))
     (file-name (string-append "nyacc-next-" version))
     (sha256 (base32 (assoc-ref nyacc-sha256-base32-map version)))))
   (build-system gnu-build-system)
   (arguments (list #:strip-binaries? #f))
   (native-inputs (list guile-3.0))
   ;; Use of ffi-helper may need gcc, but let the user do that?
   ;; See nyacc/lang/c99/util.scm.
   ;;(propagated-inputs (list gcc))
   (home-page "https://github.com/mwette/nyacc")
   (synopsis "parser generator, C parser and ffi-helper for guile")
   (license lgpl3+)
   (description
    "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.

It provides a decent C parser and a `FFI Helper' tool to help create
Guile Scheme bindings for C-based libraries.

It provides (partially implemented) compilers based on above mentioned
parsers to allow execution with Guile as extension languages.")))

;; --- last line ---
