interp.test.cc

Go to the documentation of this file.
00001 /*
00002    The lestes compiler suite
00003    Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy
00004    Copyright (C) 2002, 2003, 2004, 2005 Petr Zika
00005    Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala
00006    Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina
00007    Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda
00008    Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar
00009    Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; version 2 of the License.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    See the full text of the GNU General Public License version 2, and
00021    the limitations in the file doc/LICENSE.
00022 
00023    By accepting the license the licensee waives any and all claims
00024    against the copyright holder(s) related in whole or in part to the
00025    work, its use, and/or the inability to use it.
00026  
00027  */
00028 #include <lestes/common.hh>
00029 #include <lestes/ui/interp.hh>
00030 #include <lestes/ui/interp.g.hh>
00031 #include <lestes/ui/interp_actions.g.hh>
00032 
00033 package(lestes);
00034 package(ui);
00035 
00036 const char * code =
00037 " t nil ''t '(t) '(t . t)\n"
00038 " '(t t t nil a b c d e f) (set 'a 'b) a"
00039 " #'function #'car #'%fset"
00040 "\"aaa\""
00041 "((lambda l l) a t nil)"
00042 "(%fset 'list (lambda l l))"
00043 "(list a t t a)"
00044 "((lambda (a b) b) a t)"
00045 "((macro (a b) (list 'quote a)) baalzabub)"
00046 "(%fset 'defmacro"
00047 "       (macro (n a . b)"
00048 "             (list '%fset (list 'quote n)"
00049 "                   (list 'macro a . b))))"
00050 "(%fset 'defun"
00051 "       (macro (n a . b)"
00052 "             (list '%fset (list 'quote n)"
00053 "                   (list 'lambda a . b))))"
00054 "(defun atom (x) (not (consp x)))"
00055 "(defun not (x) (eq x nil))"
00056 "(%fset 'endp 'atom)"
00057 "(cond)"
00058 "(cond ((eq t nil) 'a)"
00059 "      (t 'b))"
00060 "(defmacro if (a b c) (list 'cond (list a b) (list t c)))"
00061 ;
00062 
00063 void yyparse();
00064 
00065 int run()
00066 {
00067         l_interpreter::init();
00068         scan_string(code);
00069         yyparse();
00070 }
00071 
00072 end_package(ui);
00073 end_package(lestes);
00074 
00075 int main(int, char **)
00076 {
00077         return lestes::ui::run();
00078 }

Generated on Mon Feb 12 18:22:36 2007 for lestes by doxygen 1.5.1-20070107