aboutsummaryrefslogtreecommitdiffstats
path: root/src/resp.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-02 06:16:29 +0000
committerDavid Robillard <d@drobilla.net>2010-12-02 06:16:29 +0000
commit563a807be78bfe12e5bfbb9ff0d6da44242696c4 (patch)
tree13cf7ce3b90d072d6e7106c7d2eb4da33209acb0 /src/resp.cpp
parent32ac40a9ef62d2109563e36fb7cd478426c3489f (diff)
downloadresp-563a807be78bfe12e5bfbb9ff0d6da44242696c4.tar.gz
resp-563a807be78bfe12e5bfbb9ff0d6da44242696c4.tar.bz2
resp-563a807be78bfe12e5bfbb9ff0d6da44242696c4.zip
Represent code as list structure (i.e. traditional LISP lists built from pairs), rather than tuple structure.
Remove unused/crufty depoly stage. Remove cps from AST interface (but keep cps.cpp code around for later). Improved command line interface for compilation stages (options -T -L -S). git-svn-id: http://svn.drobilla.net/resp/resp@277 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/resp.cpp')
-rw-r--r--src/resp.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/resp.cpp b/src/resp.cpp
index 4da92e3..96df3b7 100644
--- a/src/resp.cpp
+++ b/src/resp.cpp
@@ -39,9 +39,9 @@ print_usage(char* name, bool error)
os << " -r Enter REPL after evaluating files" << endl;
os << " -b BACKEND Use backend (llvm or c)" << endl;
os << " -g Debug (disable optimisation)" << endl;
- os << " -d Dump generated code during compilation" << endl;
os << " -P Parse and pretty-print only" << endl;
os << " -T Type check and annotate only" << endl;
+ os << " -L Lambda lift only" << endl;
os << " -S Compile to assembly only (do not evaluate)" << endl;
os << " -e EXPRESSION Evaluate EXPRESSION" << endl;
os << " -o FILE Compile output to FILE (don't run)" << endl;
@@ -61,9 +61,9 @@ main(int argc, char** argv)
files.push_back(argv[i]);
} else if (!strncmp(argv[i], "-r", 3)
|| !strncmp(argv[i], "-g", 3)
- || !strncmp(argv[i], "-d", 3)
|| !strncmp(argv[i], "-P", 3)
|| !strncmp(argv[i], "-T", 3)
+ || !strncmp(argv[i], "-L", 3)
|| !strncmp(argv[i], "-S", 3)) {
args.insert(make_pair(argv[i], ""));
} else if (i == argc-1 || argv[i+1][0] == '-') {
@@ -116,6 +116,9 @@ main(int argc, char** argv)
while (is.good() && !is.eof()) {
Cursor loc(*f);
AST* exp = readExpression(loc, is);
+ if (!exp || (exp->as<ATuple*>() && exp->as<ATuple*>()->tup_len() == 1))
+ break;
+
AST* ast = penv.parse(exp);
pprint(os, ast, cenv, false);
is.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // Skip newlines