Start a set of simple examples.

* examples/calc++/Makefile, examples/calc++/calc++-driver.cc,
* examples/calc++/calc++-driver.hh,
* examples/calc++/calc++-parser.yy,
* examples/calc++/calc++-scanner.ll, examples/calc++/calc++.cc,
* examples/calc++/compile, examples/calc++/test: New.
This commit is contained in:
Akim Demaille
2005-06-22 15:32:10 +00:00
parent 0925ebb4fa
commit 0ffd4fd1a2
9 changed files with 292 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
#include "calc++-driver.hh"
#include "calc++-parser.hh"
calcxx_driver::calcxx_driver ()
: trace_scanning (false),
trace_parsing (false)
{
variables["one"] = 1;
variables["two"] = 2;
}
calcxx_driver::~calcxx_driver ()
{
}
void
calcxx_driver::parse (const std::string &f)
{
file = f;
scan_begin ();
yy::calcxx_parser parser (*this);
parser.set_debug_level (trace_parsing);
parser.parse ();
scan_end ();
}
void
calcxx_driver::error (const yy::location& l, const std::string& m)
{
std::cerr << l << ": " << m << std::endl;
}
void
calcxx_driver::error (const std::string& m)
{
std::cerr << m << std::endl;
}