1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 12:20:20 +02:00

Add compiler chooser implementation; fix bugs with previous commit

* module/system/base/compile.scm (next-pass): Invoke the language's
  compiler chooser if there is more than one compiler.
  (compute-compiler): Ensure from and to are languages.
* module/system/base/language.scm (<language>): Add compiler-chooser
  field.
* module/language/brainfuck/spec.scm (choose-compiler, brainfuck):
  Define a compiler chooser.
This commit is contained in:
Andy Wingo 2020-05-08 22:56:37 +02:00
parent ded883b6f0
commit f711ab85b2
3 changed files with 38 additions and 26 deletions

View file

@ -1,6 +1,6 @@
;;; Brainfuck for GNU Guile.
;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
;; Copyright (C) 2009-2010,2020 Free Software Foundation, Inc.
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@ -34,10 +34,14 @@
; in #:compilers. This is the basic set of fields needed to specify a new
; language.
(define (choose-compiler compilers optimization-level opts)
(cons 'tree-il compile-tree-il))
(define-language brainfuck
#:title "Brainfuck"
#:reader (lambda (port env) (read-brainfuck port))
#:compilers `((tree-il . ,compile-tree-il)
(scheme . ,compile-scheme))
#:compiler-chooser choose-compiler
#:printer write
)