projects/guix·blob python-team · refs

436 lines · 16.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2014, 2019, 2021-2022 Ludovic Courtès <[email protected]>
3;;; Copyright © 2016, 2022, 2024-2025 Efraim Flashner <[email protected]>
4;;; Copyright © 2017, 2020, 2021 Sergei Trofimovich <[email protected]>
5;;; Copyright © 2018, 2022 Tobias Geerinckx-Rice <[email protected]>
6;;; Copyright © 2020-2021 Marius Bakke <[email protected]>
7;;; Copyright © 2021 Foo Chuan Wei <[email protected]>
8;;; Copyright © 2024-2025 Janneke Nieuwenhuizen <[email protected]>
9;;; Copyright © 2025 Alexey Abramov <[email protected]>
10;;; Copyright © 2025 Anderson Torres <[email protected]>
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages compiler-tools)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages bash)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages gawk)
33 #:use-module (gnu packages m4)
34 #:use-module (gnu packages man)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages)
37 #:use-module (guix build-system cmake)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system trivial)
40 #:use-module (guix download)
41 #:use-module (guix gexp)
42 #:use-module (guix git-download)
43 #:use-module ((guix licenses) #:prefix license:)
44 #:use-module (guix packages)
45 #:use-module (guix utils)
46 #:use-module (srfi srfi-1))
47
48(define-public byacc
49 (package
50 (name "byacc")
51 (version "20240109")
52 (source
53 (origin
54 (method url-fetch)
55 (uri (string-append
56 "https://invisible-mirror.net/archives/byacc/byacc-"
57 version ".tgz"))
58 (sha256
59 (base32
60 "0il4w1vwbglayakywyghiqhcjpg1yvv5ww2p8ylz32bi05wpg2gj"))
61 (snippet
62 #~(begin
63 ;; Remove machine-generated files
64 (for-each delete-file
65 (list "configure"
66 "btyaccpar.c"
67 "yaccpar.c"))))))
68 (build-system gnu-build-system)
69 (native-inputs
70 (list autoconf
71 automake
72 gawk))
73 (home-page "https://invisible-island.net/byacc/byacc.html")
74 (synopsis "Berkeley Yacc LALR parser generator")
75 (description
76 "Berkeley Yacc is an LALR(1) parser generator. Yacc reads the grammar
77specification from a file and generates an LALR(1) parser for it. The parsers
78consist of a set of LALR(1) parsing tables and a driver routine written in the
79C programming language.")
80 (license license:public-domain)))
81
82(define-public dparser
83 (package
84 (name "dparser")
85 (version "1.33a")
86 (source
87 (origin
88 (method git-fetch)
89 (uri (git-reference
90 (url "https://github.com/jplevyak/dparser/")
91 (commit (string-append "v" version))))
92 (file-name (git-file-name name version))
93 (sha256
94 (base32
95 "0vzfi7d573qsmfxkgnzqkalhv06i2zc8hm0pwcgrgj8382g01zg1"))))
96 (build-system gnu-build-system)
97 (arguments
98 (list
99 #:test-target "test"
100 #:make-flags
101 #~(list
102 (string-append "CC=" #$(cc-for-target))
103 (string-append "PREFIX=" #$output))
104 #:phases
105 #~(modify-phases %standard-phases
106 (delete 'configure))))
107 (home-page "https://dparser.sourceforge.net/")
108 (synopsis "Scannerless GLR parser generator")
109 (description
110 "DParser is scannerless GLR parser generator. The form of the text to be
111parsed can be specified using a combination of regular expressions and grammar
112productions. Because of the parsing technique, a scannerless GLR parser based
113on the Tomita algorithm the grammar can be ambiguous, right or left recursive,
114have any number of null productions, and because there is no separate
115tokenizer, can include whitespace in terminals and have terminals which are
116prefixes of other terminals.")
117 (license (list license:bsd-3))))
118
119(define-public flex
120 (package
121 (name "flex")
122 (version "2.6.4")
123 (source
124 (origin
125 (method url-fetch)
126 (uri (string-append
127 "https://github.com/westes/flex"
128 "/releases/download/v" version "/"
129 "flex-" version ".tar.gz"))
130 (sha256
131 (base32
132 "15g9bv236nzi665p9ggqjlfn4dwck5835vf0bbw2cz7h5c1swyp8"))))
133 (build-system gnu-build-system)
134 (arguments
135 (if (%current-target-system)
136 (list #:configure-flags
137 #~'("ac_cv_func_malloc_0_nonnull=yes"
138 "ac_cv_func_realloc_0_nonnull=yes"))
139 '()))
140 (native-inputs
141 (list ;; m4 is not present in PATH when cross-building
142 m4))
143 (inputs
144 (list
145 (package
146 (inherit bison)
147 (arguments
148 ;; Disable tests, since they require flex.
149 (substitute-keyword-arguments arguments
150 ((#:tests? _ #f) #f)))
151 (inputs (modify-inputs inputs
152 (delete "flex"))))))
153 (propagated-inputs (list m4))
154 (home-page "https://github.com/westes/flex")
155 (synopsis "Fast lexical analyser generator")
156 (description
157 "Flex is a tool for generating scanners. A scanner, sometimes
158called a tokenizer, is a program which recognizes lexical patterns in
159text. The flex program reads user-specified input files, or its standard
160input if no file names are given, for a description of a scanner to
161generate. The description is in the form of pairs of regular expressions
162and C code, called rules. Flex generates a C source file named,
163\"lex.yy.c\", which defines the function yylex(). The file \"lex.yy.c\"
164can be compiled and linked to produce an executable. When the executable
165is run, it analyzes its input for occurrences of text matching the
166regular expressions for each rule. Whenever it finds a match, it
167executes the corresponding C code.")
168 (license (license:non-copyleft "file://COPYING"
169 "See COPYING in the distribution."))))
170
171;;; The package is named orangeduck-mpc to differentiate it from GNU mpc.
172(define-public orangeduck-mpc
173 ;; The last release lacks an 'install' target.
174 (let ((commit "1049534fc56b1971345c7aaa792dea55d6f9b7bc")
175 (revision "1"))
176 (package
177 (name "orangeduck-mpc")
178 (version (git-version "0.9.0" revision commit))
179 (source (origin
180 (method git-fetch)
181 (uri (git-reference
182 (url "https://github.com/orangeduck/mpc")
183 (commit commit)))
184 (file-name (git-file-name name version))
185 (sha256
186 (base32
187 "1wpxchbjxsyksr8il9pvg195nvqzsjdshzyzwikxda0fss0p7aap"))))
188 (build-system gnu-build-system)
189 (arguments
190 (list #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
191 (string-append "PREFIX=" #$output))
192 #:phases #~(modify-phases %standard-phases
193 (add-after 'unpack 'patch-Makefile
194 (lambda _
195 (substitute* "Makefile"
196 ;; Do not attempt to alter the permissions,
197 ;; otherwise 'install' would error with
198 ;; "cannot stat [...] Permission denied"
199 ;; errors.
200 (("\\s\\-m[0-9]{3}\\s")
201 " "))))
202 (delete 'configure))))
203 (home-page "https://github.com/orangeduck/mpc")
204 (synopsis "Parser Combinator library for C")
205 (description "@code{mpc} is a lightweight Parser Combinator library for C.
206@code{mpc} can help with tasks such as:
207@itemize
208@item Building a new programming language
209@item Building a new data format
210@item Parsing an existing programming language
211@item Parsing an existing data format
212@item Embedding a Domain Specific Language
213@item Implementing Greenspun's Tenth Rule.
214@end itemize")
215 (license license:bsd-2))))
216
217(define-public lexy
218 (package
219 (name "lexy")
220 (version "2025.05.0")
221 (source
222 (origin
223 (method git-fetch)
224 (uri (git-reference
225 (url "https://github.com/foonathan/lexy")
226 (commit (string-append "v" version))))
227 (file-name (git-file-name name version))
228 (sha256
229 (base32 "14j2z7x2l65q95j5br5nw7awgd87p9m2xw7mma4qspiricd0rniq"))))
230 (build-system cmake-build-system)
231 (arguments
232 (list
233 #:configure-flags
234 #~(list "-DLEXY_BUILD_DOCS=OFF") ; needs Hugo
235 #:phases
236 #~(modify-phases %standard-phases
237 (add-after 'unpack 'fix-dependencies
238 (lambda _
239 (substitute* "tests/CMakeLists.txt"
240 (("^message\\(STATUS \"Fetching doctest\"\\).*") "")
241 (("^include\\(FetchContent\\).*") "")
242 (("^FetchContent_Declare\\(doctest .*") "")
243 (("^FetchContent_MakeAvailable\\(doctest\\)")
244 "find_package(doctest REQUIRED)")
245 (("^(target_link_libraries\\(lexy_test_base .*) doctest\\)"
246 _ prefix)
247 (string-append prefix ")"))))))))
248 (native-inputs (list doctest))
249 (home-page "https://lexy.foonathan.net/")
250 (synopsis "C++ parser combinator library")
251 (description
252 "lexy is a parser combinator library for C++17 and later.")
253 (license license:boost1.0)))
254
255(define-public oyacc
256 (package
257 (name "oyacc")
258 (version "6.6")
259 (source
260 (origin
261 (method git-fetch)
262 (uri (git-reference
263 (url "https://github.com/ibara/yacc")
264 (commit (string-append name "-" version))))
265 (file-name (git-file-name name version))
266 (sha256
267 (base32 "1a2nyg2nnh1las40klnp037sapaaph86kjx258cpqcwnk4cv3rnx"))))
268 (build-system gnu-build-system)
269 (arguments
270 (list
271 #:test-target "test"
272 #:make-flags
273 #~(list (string-append "BINDIR=" #$output "/bin")
274 (string-append "MANDIR=" #$output "/share/man/man1"))))
275 (home-page "https://github.com/ibara/yacc")
276 (synopsis "Portable YACC from OpenBSD")
277 (description
278 "@command{oyacc} is a portable version of the OpenBSD's
279@acronym{yacc, Yet Another Compiler Compiler} program, with no dependencies
280besides libc.")
281 (license license:bsd-2)))
282
283(define-public oyacc-as-yacc-wrapper
284 (package/inherit oyacc
285 (name "oyacc-as-yacc-wrapper")
286 (build-system trivial-build-system)
287 (arguments
288 (list
289 #:builder
290 (with-imported-modules '((guix build utils))
291 #~(begin
292 (use-modules (guix build utils))
293 (let ((bindir (string-append #$output "/bin"))
294 (oyacc (string-append #$(this-package-input "oyacc")
295 "/bin/oyacc")))
296 (mkdir-p bindir)
297 (symlink oyacc (string-append bindir "/yacc")))))))
298 (inputs (list oyacc))
299 (description
300 "This package provides the @command{yacc} command, implemented as a
301symbolic link to the @command{oyacc} command from the same-named package.")))
302
303(define-public packcc
304 (package
305 (name "packcc")
306 (version "3.1.0")
307 (source
308 (origin
309 (method git-fetch)
310 (uri (git-reference
311 (url "https://github.com/arithy/packcc")
312 (commit (string-append "v" version))))
313 (file-name (git-file-name name version))
314 (sha256
315 (base32
316 "00aad9hx9kks2wyba8m2gb1pgsc1sxfpgndnfqhs7jswzks6455w"))))
317 (build-system cmake-build-system)
318 (arguments
319 (list
320 #:modules
321 '((guix build cmake-build-system)
322 ((guix build gnu-build-system) #:prefix gnu:)
323 (guix build utils))
324 #:phases
325 #~(modify-phases %standard-phases
326 ;; INFO: This project does not use ctest.
327 (replace 'check
328 (assoc-ref gnu:%standard-phases 'check)))))
329 (native-inputs
330 (list bats python))
331 (home-page "https://github.com/arithy/packcc")
332 (synopsis "Packrat parser generator for C")
333 (description
334 "PackCC is a @url{https://arxiv.org/abs/cs/0603077, packrat}
335parser generator for the C programming language. Its main features are:
336@itemize
337@item Generates a parser in C from a grammar described in a PEG.
338@item Gives your parser great efficiency by packrat parsing.
339@item Supports direct and indirect left-recursive grammar rules.
340@end itemize
341The grammar of your parser can be described in a @acronym{PEG, Parsing
342Expression Grammar}. The PEG is a top-down parsing language, and is similar
343to the regular-expression grammar. The PEG does not require tokenization to
344be a separate step, and tokenization rules can be written in the same way as
345any other grammar rules.")
346 (license license:expat)))
347
348(define-public pegtl
349 (package
350 (name "pegtl")
351 (version "3.2.7")
352 (source
353 (origin
354 (method git-fetch)
355 (uri (git-reference
356 (url "https://github.com/taocpp/PEGTL")
357 (commit version)))
358 (file-name (git-file-name name version))
359 (sha256
360 (base32
361 "01adjqqdr9yf4h379jl1x0526kvixfpqk4hdk9mna49qc4s5hpi1"))))
362 (build-system cmake-build-system)
363 (home-page "https://github.com/taocpp/PEGTL")
364 (synopsis "Parsing Expression Grammar template library")
365 (description
366 "The @acronym{PEGTL, Parsing Expression Grammar Template Library} is a
367zero-dependency C++ header-only parser combinator library for creating parsers
368according to a @acronym{PEG, Parsing Expression Grammar}.")
369 (license license:expat)))
370
371(define-public re2c
372 (package
373 (name "re2c")
374 (version "4.2")
375 (source
376 (origin
377 (method url-fetch)
378 (uri (string-append "https://github.com/skvadrik/" name
379 "/releases/download/" version "/"
380 name "-" version ".tar.xz"))
381 (sha256
382 (base32
383 "07ysqgdm0h566a8lwnpdgycp93vz7zskzihsgah3bla0ycj2pp69"))))
384 (build-system gnu-build-system)
385 (arguments
386 (list
387 #:tests?
388 (not (or (%current-target-system)
389 ;; TODO: run_tests.py hangs
390 (system-hurd?)))
391 #:phases
392 (if (target-arm32?)
393 #~(modify-phases %standard-phases
394 (add-after 'unpack 'patch-sources
395 (lambda _
396 (invoke "patch" "-p1" "--force" "--input"
397 #$(local-file (search-patch
398 "re2c-Use-maximum-alignment.patch"))))))
399 #~%standard-phases)))
400 (native-inputs
401 (list python)) ; for the test driver
402 (home-page "https://re2c.org/")
403 (synopsis "Lexer generator")
404 (description
405 "@code{re2c, Regular Expressions to Code} is a flexible lexical analyser.
406Instead of using traditional table-driven approaches, it encodes a finite
407state machine directly in the code in the form of jumps and comparisons.")
408 (license license:public-domain)))
409
410(define-public reflex
411 (package
412 (name "reflex")
413 (version "20260131")
414 (source
415 (origin
416 (method url-fetch)
417 (uri (string-append
418 "https://invisible-island.net/archives/reflex/reflex-"
419 version ".tgz"))
420 (sha256
421 (base32 "1ga82ycrfmfq6g3r8b8ixlhj82wnlwf9kibzhyivjfv26dgscldb"))
422 (snippet
423 #~(begin
424 (delete-file "configure")))))
425 (build-system gnu-build-system)
426 (native-inputs
427 (list autoconf
428 automake
429 ;; Works with any POSIX yacc, but let's use a non-self-hosted one.
430 oyacc-as-yacc-wrapper))
431 (home-page "https://invisible-island.net/reflex/reflex.html")
432 (synopsis "Variant of flex lexical scanner")
433 (description
434 "Reflex is a POSIX-compatible variant of the @command{flex} lexical scanner
435generator.")
436 (license license:bsd-2)))