1 ;;; -*- mode: scheme; coding: utf-8; -*-
3 ;;; Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
5 ;;; This library is free software; you can redistribute it and/or
6 ;;; modify it under the terms of the GNU Lesser General Public
7 ;;; License as published by the Free Software Foundation; either
8 ;;; version 3 of the License, or (at your option) any later version.
10 ;;; This library is distributed in the hope that it will be useful,
11 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;; Lesser General Public License for more details.
15 ;;; You should have received a copy of the GNU Lesser General Public
16 ;;; License along with this library; if not, write to the Free Software
17 ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 (use-modules (language tree-il)
20 (language tree-il optimize)
21 (language tree-il canonicalize)
25 ;; Avoid gratuitous churn in psyntax-pp.scm due to the marks and labels
26 ;; changing session identifiers.
27 (set! syntax-session-id (lambda () "*"))
29 (let ((source (list-ref (command-line) 1))
30 (target (list-ref (command-line) 2)))
31 (let ((in (open-input-file source))
32 (out (open-output-file (string-append target ".tmp"))))
33 (write '(eval-when (compile) (set-current-module (resolve-module '(guile))))
36 (let loop ((x (read in)))
42 (pretty-print (tree-il->scheme
45 (macroexpand x 'c '(compile load eval))
51 (system (format #f "mv -f ~s.tmp ~s" target target)))