Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
compiler.h
Go to the documentation of this file.
1 //
2 // Project: Lhogho
3 // File: compiler.c
4 //
5 // Copyright (C) 2007 P.Boytchev
6 //
7 // Revision history:
8 // 2007-06-11 - file created
9 // 2007-06-19 - compile() renamed to compile_from_options()
10 // 2007-07-29 - changed parameters of init_compiler()
11 // 2010-06-25 - added inner_eof
12 // 2011-10-13 - support for Logo macros
13 //
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; either version 2 of the License, or
18 // (at your option) any later version.
19 //
20 // This program is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU General Public License for more details.
24 //
25 // You should have received a copy of the GNU General Public License
26 // along with this program; if not, write to the Free Software
27 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 //
29 
30 
31 #ifndef LHOGHO_COMPILER_H
32 #define LHOGHO_COMPILER_H
33 
34 #include "globals.h"
35 #include "atoms.h"
36 
37 typedef struct ctxnode {
38  //atom tags; ///< list of collected tags
39  //int repdepth; ///< number of nested REPEATs so far
40  int size;
43  int exit_addr;
44 } context_t;
45 
46 
47 #define COMPILE_AS_FUNC 0
48 #define COMPILE_AS_PROC 1
49 #define COMPILE_AS_UNKNOWN 2
50 
51 
53 #define COMPILE_AS_NON_MACRO 0
54 #define COMPILE_AS_MACRO 1
55 
56 // ===========================================================
57 // A magic number used to identify embedded Lhogho sources
58 // ===========================================================
59 
60 #define MAGIC_NUMBER 1980069381
61 #define MAGIC_COMPILER_NUMBER 1761700097
62 
63 extern int running_compiled_code;
64 extern int compiling_code;
65 
67 extern void finit_compiler( );
68 extern int compile_from_options( );
69 extern atom_t compile_to_file( );
70 extern atom_t compile_function( atom_t func, int mode, int is_macro );
72 extern atom_t compile_internal_function( atom_t func, int static_link );
73 extern int run_source( chars_t source );
74 extern int run_function( atom_t function );
75 
76 #endif //LHOGHO_COMPILER_H

[ HOME | INDEX | ATOMS | VARS | REFERENCE ]
Lhogho Developer's Documentation
Wed Jul 10 2013