<?xml version="1.0" encoding="utf-8"?><feedxmlns="http://www.w3.org/2005/Atom"><title>null_radix</title><subtitle>Recent Posts</subtitle><updated>2020-03-21T17:12:31-0400</updated><linkhref="nullradix.eth/feed.xml"rel="self"/><linkhref="nullradix.eth"/><entry><title>Merklizing ASTs</title><author><name>mjbecze</name><email>mjbecze@riseup.net</email></author><updated>2015-12-29T13:22:00-0500</updated><linkhref="/merklizing-asts.html"rel="alternate"/><summarytype="html"><p><em>Special thanks to <a href="http://juan.benet.ai/">Juan Benet</a> for mentioning this idea at Devcon 1.</em></p><p>Recently I wrote a draft of <a href="https://github.com/ethereum/EIPs/issues/48">EIP 105</a> which propose using a subset of webassembly as Ethereum’s VM. If you aren’t aware webassembly “is a new, portable, size- and load-time-efficient format suitable for compilation to the web.” One interesting note about Webassembly doesn’t compile to linear byte code. Instead it uses an <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax Tree (AST)</a>. This might not surprise you if you have an experience with LLVM IR. But for me it was a new concept to have bytecode in this form.</p><h2>What is an AST?</h2><p>It is just a tree repesentation of some code. Each node of the AST represents an expression. Each function body consists of exactly one expression. Compared to the source code, an AST does not include certain elements, such as inessential punctuation and delimiters (braces, semicolons, parentheses, etc.).</p><p>To give you a better idea here is a textual representation of some webassembly code using <a href="https://en.wikipedia.org/wiki/S-expression">s-expressions</a>.</p><pre><code><span class="syntax-comment">;; Recursive factorial
<?xml version="1.0" encoding="utf-8"?><feedxmlns="http://www.w3.org/2005/Atom"><title>null_radix</title><subtitle>Recent Posts</subtitle><updated>2020-03-21T17:36:34-0400</updated><linkhref="nullradix.eth/feed.xml"rel="self"/><linkhref="nullradix.eth"/><entry><title>Merklizing ASTs</title><author><name>mjbecze</name><email>mjbecze@riseup.net</email></author><updated>2015-12-29T13:22:00-0500</updated><linkhref="/merklizing-asts.html"rel="alternate"/><summarytype="html"><p><em>Special thanks to <a href="http://juan.benet.ai/">Juan Benet</a> for mentioning this idea at Devcon 1.</em></p><p>Recently I wrote a draft of <a href="https://github.com/ethereum/EIPs/issues/48">EIP 105</a> which propose using a subset of webassembly as Ethereum’s VM. If you aren’t aware webassembly “is a new, portable, size- and load-time-efficient format suitable for compilation to the web.” One interesting note about Webassembly doesn’t compile to linear byte code. Instead it uses an <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax Tree (AST)</a>. This might not surprise you if you have an experience with LLVM IR. But for me it was a new concept to have bytecode in this form.</p><h2>What is an AST?</h2><p>It is just a tree repesentation of some code. Each node of the AST represents an expression. Each function body consists of exactly one expression. Compared to the source code, an AST does not include certain elements, such as inessential punctuation and delimiters (braces, semicolons, parentheses, etc.).</p><p>To give you a better idea here is a textual representation of some webassembly code using <a href="https://en.wikipedia.org/wiki/S-expression">s-expressions</a>.</p><pre><code><span class="syntax-comment">;; Recursive factorial