generate platform_ops.h from platform_ops.proto, and reduce dependencies
[proto.git] / src / compiler-app.cpp
blobd8554f8b5922981f13c3024c1d6eda206b2f99db
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. */
9 #include "config.h"
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include "utils.h"
13 #include "compiler.h"
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);
26 // load the script
27 int len;
28 if(args->argc==1) {
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);
32 } else {
33 post("WARNING: %d unhandled arguments:",args->argc-2);
34 for(int i=2;i<args->argc;i++) post(" '%s'",args->argv[i-1]);
35 post("\n");
38 exit(0);
42 /// test suite!
43 extern void test_compiler_utils();
45 void run_test_suite() {
46 test_compiler_utils();