1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-06-20 00:06:55 +01:00

significant optimisation of the math interpreter using integer address tables for variables and functions

This commit is contained in:
2014-04-08 19:48:52 +01:00
parent b0f6c30445
commit 47e159e041
9 changed files with 239 additions and 144 deletions

View File

@ -21,7 +21,7 @@ int main(int argc, char* argv[])
RunContext context;
cout << "-- Source code:" << endl << source << endl << endl;
interpreter.compile();
interpreter.compile(context);
cout << "-- Abstract Syntax Tree:" << endl;
if (interpreter.getAST())
{
@ -32,7 +32,18 @@ int main(int argc, char* argv[])
cout << "<null>" << endl << endl;
}
cout << "-- Program:" << endl << interpreter << endl;
StdMath::addStdMathFunc(context.fTable);
cout << "-- Variable table:" << endl;
for (auto &v: context.vTable)
{
cout << "'" << v.first << "': " << v.second << endl;
}
cout << endl;
cout << "-- Function table:" << endl;
for (auto &f: context.fTable)
{
cout << "'" << f.first << "': " << f.second << endl;
}
cout << endl;
interpreter(context);
if (!context.dStack.empty())
{