Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
if [[ $1 == "--help" ]]; then
echo "Usage: compile-test <source>"
echo "Utility for small evm backend test cases. Takes a C source file, compiles it to llvm IR, and runs the backend."
echo "All data, including the source file, llvm IR, output, and logs are moved to a directory of the same name for ease of organization."
echo "IMPORTANT: a symlink to the correct llc must be present in the current directory. Please make one, or this will fail silently."
exit 0
fi
@jakelang
jakelang / yul.pest
Last active May 31, 2019 20:09
A Yul grammar file for use with PEST
block = { soi? ~ "{" ~ (statement)* ~ "}" ~ eoi? }
statement = {
(block
| function_definition
| variable_declaration
| assignment
| if_statement
| for_loop
| expression
@jakelang
jakelang / log.wat
Created January 16, 2019 21:45
WAST for an ewasm smart contract
(module
(type (;0;) (func (param i32 i32 i32 i32 i32 i32 i32)))
(type (;1;) (func (result i32)))
(type (;2;) (func (param i32 i32 i32)))
(type (;3;) (func (param i32 i32)))
(type (;4;) (func))
(type (;5;) (func (param i32)))
(type (;6;) (func (param i32 i32) (result i32)))
(type (;7;) (func (param i32) (result i64)))
(import "ethereum" "log" (func $ethereum_log (type 0)))