1 /* Standalone compiler app
2 Copyright (C) 2005-2008, Jonathan Bachrach, Jacob Beal, and contributors
3 listed in the AUTHORS file in the MIT Proto distribution's top directory.
5 This file is part of MIT Proto, and is distributed under the terms of
6 the GNU General Public License, with a linking exception, as described
7 in the file LICENSE in the MIT Proto distribution's top directory. */
15 void run_test_suite(); // testing kludge
17 int main (int argc
, char *argv
[]) {
18 post("PROTO v%d (%d OPS) (Developed by MIT Space-Time Programming Group 2005-2008)\n", PROTO_VERSION
, CORE_CMD_OPS
);
19 Args
*args
= new Args(argc
,argv
); // set up the arg parser
21 if(args
->extract_switch("--test")) { run_test_suite(); exit(0); }
23 Compiler
* compiler
= new Compiler(args
);
24 compiler
->init_standalone(args
);
29 uint8_t* s
= compiler
->compile("(app)",&len
);
30 } else if(args
->argc
==2) {
31 uint8_t* s
= compiler
->compile(args
->argv
[args
->argc
-1],&len
);
33 post("WARNING: %d unhandled arguments:",args
->argc
-2);
34 for(int i
=2;i
<args
->argc
;i
++) post(" '%s'",args
->argv
[i
-1]);
43 extern void test_compiler_utils();
45 void run_test_suite() {
46 test_compiler_utils();