evmcompiler

Compiles an AST (Abstract Syntax Tree) to Ethereum Virtual Machine bytecodes, WIP.

Usage no npm install needed!

<script type="module">
  import evmcompiler from 'https://cdn.skypack.dev/evmcompiler';
</script>

README

EVM Compiler

Compiles an AST (Abstract Syntax Tree) to Ethereum Virtual Machine bytecodes, WIP.

Design

TBD

Versions

  • 0.0.1 First published version
  • 0.0.2 Fix check datasize; fix binary order evaluation; using geast@0.0.7
  • 0.0.3 Process local variables, loop and conditional commands
  • 0.0.4 Process break and continue commands
  • 0.0.5 For command, fnhash in API, stop in void method, local variables management first implementation
  • 0.0.6 Array variable declaration and access, signed mod and div, process call, context redesign, logical operations, addmod mulmod operations
  • 0.0.7 Attributes in method node
  • 0.0.8 Using function instead of method

To Do

  • Management of local variables (partial)
  • Call private, internal, external methods
  • Pass arguments in stack when needed
  • Returns result in stack when needed
  • Contract inheritance
  • String support
  • Mapping support
  • Dynamic arrays support
  • Static array support
  • Call another contract
  • Transfer value to another address
  • Pure, view methods
  • Generate ABI

References

Contribution

Feel free to file issues and submit pull requests — contributions are welcome.

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.