From 829198553c89ca7f2da93559c61c04ee89079ea1 Mon Sep 17 00:00:00 2001 From: fche Date: Thu, 5 May 2005 20:31:53 +0000 Subject: * preliminaries for code generation logic 2005-05-05 Frank Ch. Eigler * parse.cxx (parse): Add helper methods. (lexer::scan, parse_assignment): Parse "<<<" operator. Fix assignment associativity. (parse_symbol): Permit function with empty arg list. (parse_global, parse_statement, parse_functiondecl): Expect unconsumed leading keyword. (parse_global): Don't use ";" termination. * parse.h: Corresponding changes. * staptree.cxx (binary_expression::resolve_types): Fix <<< type inference. (translator_output): Improve pretty-printing. (*): Add general visitors to statement/expression types. * staptree.h: Corresponding changes. Tweak symresolution_info fields. Add semantic_error class. * semtest.cxx: Adapt to this. * testsuite/parseok/two.stp, semok/*.stp: Adapt to syntax changes. --- semtest.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'semtest.cxx') diff --git a/semtest.cxx b/semtest.cxx index a37e3323..09cd7576 100644 --- a/semtest.cxx +++ b/semtest.cxx @@ -21,7 +21,7 @@ semantic_pass_1 (vector& files) for (unsigned j=0; jfunctions.size(); j++) { functiondecl* fn = f->functions[j]; - symresolution_info ri (fn->locals, f->globals, files, f, fn); + symresolution_info ri (fn->locals, f->globals, f->functions, fn); fn->body->resolve_symbols (ri); if (ri.num_unresolved) @@ -32,7 +32,7 @@ semantic_pass_1 (vector& files) for (unsigned j=0; jprobes.size(); j++) { probe* pn = f->probes[j]; - symresolution_info ri (pn->locals, f->globals, files, f); + symresolution_info ri (pn->locals, f->globals, f->functions); pn->body->resolve_symbols (ri); if (ri.num_unresolved) @@ -113,8 +113,7 @@ main (int argc, char *argv []) vector files; if (argc == 1) { - parser p (cin); - stapfile* f = p.parse (); + stapfile* f = parser::parse (cin); if (f) files.push_back (f); else @@ -122,8 +121,7 @@ main (int argc, char *argv []) } else for (int i = 1; i < argc; i ++) { - parser p (argv[i]); - stapfile* f = p.parse (); + stapfile* f = parser::parse (argv[i]); if (f) files.push_back (f); else @@ -131,7 +129,8 @@ main (int argc, char *argv []) } rc += semantic_pass_1 (files); - rc += semantic_pass_2 (files); + if (rc == 0) + rc += semantic_pass_2 (files); for (unsigned i=0; i