From 51e6c251641eef12ba93b725974faa35b514d636 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 26 May 2014 19:41:46 +0200 Subject: New Assembler. --- Compiler.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'Compiler.cpp') diff --git a/Compiler.cpp b/Compiler.cpp index afe84eb4..777bb72d 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -27,12 +27,12 @@ using namespace std; using namespace eth; -bytes eth::compileLLL(string const& _s, vector* _errors) +bytes eth::compileLLL(string const& _src, vector* _errors) { try { CompilerState cs; - bytes ret = CodeFragment::compile(_s, cs).code(); + bytes ret = CodeFragment::compile(_src, cs).code(); for (auto i: cs.treesToKill) killBigints(i); return ret; @@ -50,6 +50,29 @@ bytes eth::compileLLL(string const& _s, vector* _errors) return bytes(); } +std::string eth::compileLLLToAsm(std::string const& _src, std::vector* _errors) +{ + try + { + CompilerState cs; + string ret = CodeFragment::compile(_src, cs).assembly(); + for (auto i: cs.treesToKill) + killBigints(i); + return ret; + } + catch (Exception const& _e) + { + if (_errors) + _errors->push_back(_e.description()); + } + catch (std::exception) + { + if (_errors) + _errors->push_back("Parse error."); + } + return string(); +} + string eth::parseLLL(string const& _src) { sp::utree o; -- cgit v1.2.3