aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/repl.cpp5
-rw-r--r--src/resp.cpp31
2 files changed, 20 insertions, 16 deletions
diff --git a/src/repl.cpp b/src/repl.cpp
index a1d3e74..52d35c5 100644
--- a/src/repl.cpp
+++ b/src/repl.cpp
@@ -96,7 +96,7 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute)
if (cenv.args.find("-T") != cenv.args.end()) {
for (Parsed::const_iterator i = parsed.begin(); i != parsed.end(); ++i)
- pprint(cout, *i, &cenv, true);
+ pprint(cout, *i, &cenv, (cenv.args.find("-a") != cenv.args.end()));
return 0;
}
@@ -113,7 +113,8 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute)
if (cenv.args.find("-L") != cenv.args.end()) {
for (Code::const_iterator i = lifted.begin(); i != lifted.end(); ++i)
- pprint(cout, *i, &cenv, true);
+ pprint(cout, *i, &cenv, (cenv.args.find("-a") != cenv.args.end()));
+
return 0;
}
diff --git a/src/resp.cpp b/src/resp.cpp
index e3c956f..765939c 100644
--- a/src/resp.cpp
+++ b/src/resp.cpp
@@ -68,16 +68,18 @@ print_usage(char* name, bool error)
os << "Usage: " << name << " [OPTION]... [FILE]..." << endl;
os << "Evaluate and/or compile Resp code" << endl;
os << endl;
- os << " -h Display this help and exit" << endl;
- os << " -r Enter REPL after evaluating files" << endl;
- os << " -b BACKEND Use backend (llvm or c)" << endl;
- os << " -g Debug (disable optimisation)" << 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;
+ os << " -a Annotate output with types" << endl;
+ os << " -b BACKEND Use backend (llvm or c)" << endl;
+ os << " -e EXPRESSION Evaluate EXPRESSION" << endl;
+ os << " -g Debug (disable optimisation)" << endl;
+ os << " -h Display this help and exit" << endl;
+ os << " -o FILE Compile output to FILE (don't run)" << endl;
+ os << " -r Enter REPL after evaluating files" << endl;
+ os << " -P Parse only" << endl;
+ os << " -T Type check only" << endl;
+ os << " -L Lambda lift only" << endl;
+ os << " -S Compile to assembly only (do not execute)" << endl;
+
return error ? 1 : 0;
}
@@ -92,12 +94,13 @@ main(int argc, char** argv)
return print_usage(argv[0], false);
} else if (argv[i][0] != '-') {
files.push_back(argv[i]);
- } else if (!strncmp(argv[i], "-r", 3)
- || !strncmp(argv[i], "-g", 3)
+ } else if (!strncmp(argv[i], "-L", 3)
|| !strncmp(argv[i], "-P", 3)
+ || !strncmp(argv[i], "-S", 3)
|| !strncmp(argv[i], "-T", 3)
- || !strncmp(argv[i], "-L", 3)
- || !strncmp(argv[i], "-S", 3)) {
+ || !strncmp(argv[i], "-a", 3)
+ || !strncmp(argv[i], "-g", 3)
+ || !strncmp(argv[i], "-r", 3)) {
args.insert(make_pair(argv[i], ""));
} else if (i == argc-1 || argv[i+1][0] == '-') {
return print_usage(argv[0], true);