| 78 | } |
| 79 | |
| 80 | void interpret(std::string const& _source, bool _inspect, bool _disableExternalCalls) |
| 81 | { |
| 82 | std::shared_ptr<AST const> ast; |
| 83 | std::shared_ptr<AsmAnalysisInfo> analysisInfo; |
| 84 | tie(ast, analysisInfo) = parse(_source); |
| 85 | if (!ast || !analysisInfo) |
| 86 | return; |
| 87 | |
| 88 | InterpreterState state; |
| 89 | state.maxTraceSize = 10000; |
| 90 | try |
| 91 | { |
| 92 | if (_inspect) |
| 93 | InspectedInterpreter::run(std::make_shared<Inspector>(_source, state), state, *ast, _disableExternalCalls, /*disableMemoryTracing=*/false); |
| 94 | else |
| 95 | Interpreter::run(state, *ast, _disableExternalCalls, /*disableMemoryTracing=*/false); |
| 96 | } |
| 97 | catch (InterpreterTerminatedGeneric const&) |
| 98 | { |
| 99 | } |
| 100 | |
| 101 | state.dumpTraceAndState(std::cout, /*disableMemoryTracing=*/false); |
| 102 | } |
| 103 | |
| 104 | } |
| 105 | |