Lua CLL Parser

As an initial test I've rewritten the pythereum CLL parser to support Lua syntax instead of python syntax. The code is still based on the Ethereum Script 1.0 version as the 2.0 version is not available. I tried to stay as close as possible to the existing code base. Also anticipating future adoptions.

All code constructs supported by the CLL compiler available on github are supported. Some shortcomings of the initial code ( especially regarding 'else' and 'else if' clauses are eliminated. There are still quite some bugs as the whole Ethereum Script development is obviously quite in flux.

The reason for doing this is that I'm convinced that an essential part of the Ethereum contract scripts will also have to run off the blockchain to be validated in more complicated cases. With a Lua VM global stack this becomes way easier.

Anyway, the code looks almost identical in Lua and in Python but is more forgiving regarding spaces and indentions. An essential thing when typing code into simple browser text fields. Beside this there are already many excellent AST parsers for Lua.

So, what does it look like:

if tx.value < 25 * 10^18 then
stop
elseif tx.value < 1000 then
stop
end
contract.storage[tx.data[0]] = tx.data[1]

As there will constantly be updates to the functionality of Ethereum CLL I plan to continuously update the Lua version, too.

Check it out for yourself:

https://github.com/nestorsilk/pyethereum/tree/master/compiler


Nestor
Sign In or Register to comment.