GithubHelp home page GithubHelp logo

isabella232 / aebytecode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aeternity/aebytecode

0.0 0.0 0.0 2.04 MB

Aeternity virtual machines byte code modules

License: ISC License

Erlang 99.70% Makefile 0.30%

aebytecode's Introduction

aebytecode

A library and stand alone assembler for aeternity bytecode.

This version supports AEVM bytecode and FATE bytecode.

Build

$ make

Fate Code

Fate code exists in 3 formats:

  1. Fate byte code. This format is under consensus.
  2. Fate assembler. This is a text represenation of fate code. This is not under consensus and other implemenation and toolchains could have their own format.
  3. Internal. This is an Erlang representation of fate code Used by this particular engin implementation.

This library handles all three representations. The byte code format is described in a separate document. The internal format is described in a separate document. The text representation is described below.

Fate Assembler Code

Assembler code can be read from a file. The assembler has the following format:

Comments start with 2 semicolons and runs till end of line ;; This is a comment

Opcode mnemonics start with an upper case letter. DUP

Identifiers start with a lower case letter an_identifier

References to function arguments start with arg followed by an integer arg0

References to variables/registers start with var followed by an integer var0

References to stack postions is either a (for stack 0) or start with stack followed by an integer stack1 a

Immediate values can be of 10 types:

  1. Integers as decimals: {Digits} or -{Digits} 42 -2374683271468723648732648736498712634876147 And integers as Hexadecimals:: 0x{Hexdigits} 0x0deadbeef0

  2. Chain Objects. These are all addresses to different types of chain objects. Each address is a 256 bits number encoded in base58 with checksum with a prefix of "@" plus a type prefix followed by "_".

2a. Account Address: a base58c encoded number starting with @ak_ followed by a number of base58chars '@ak_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv`

2b. Contract address: @ct_{base58char}+ @ct_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv

2c. Oracle address: @ok_{base58char}+ @ok_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv

2d. Oracle query: @oq_{base58char}+ @oq_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv

2e. Channel address: @ch_{base58char}+ @ch_nv5B93FPzRHrGNmMdTDfGdd5xGZvep3MVSpJqzcQmMp59bBCv

  1. Boolean true or false true false

  2. Strings "{Characters}" "Hello"

  3. Map { Key => Value } {} { 1 => { "foo" => true, "bar" => false}

  4. Lists [ Elements ] [] [1, 2]

  5. Bit field < Bits > or !< Bits > <000> <1010 1010> <> !<>

  6. Tuples ( Elements ) () (1, "foo")

  7. Variants: (| [Arities] | Tag | ( Elements ) |) (| [1,3,5,2] | 3 | ( "foo", 12) |)

  8. Bytes: #{base64char}+ #AQIDCioLFQ==

  9. Contract bytearray (code of another smart contract) @cb_+PJGA6A4Fz4T2LHV5knITCldR3rqO7HrXO2zhOAR9JWNbhf8Q8C4xbhx/gx8JckANwAXfQBVACAAAP4vhlvZADcABwECgv5E1kQfADcBBzcACwAWMBReAHMAFjBvJFMAFjBvggOoFAAUABQSggABAz/+tIwWhAA3AAdTAAD+1jB5kAQ3AAcLAAD+6MRetgA3AQc3ABoGggABAz+4TS8GEQx8JclFY2FsbGVyX2lzX2NyZWF0b3IRL4Zb2Q1nZXQRRNZEHxFpbml0EbSMFoQdYmFsYW5jZRHWMHmQFXZhbHVlEejEXrYNc2V0gi8AhTQuMy4wAUqQ8s4=

Where

Digits: [0123456789]

Hexdigits: [0123456789abcdef]

base58char: [123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]

base64char: [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy0123456789+/=]

Characters: any printable ascii character 0..255 (except " no quoting yet)

Key: any value except for a map

Bits: 01 or space

Elements: Nothing or Value , Elements

Size: Digits (0 < Size < 256)

Tag: Digits (0 =< Tag < Size)

aebytecode's People

Contributors

hanssv avatar ulfnorell avatar happi avatar thomasarts avatar gorillainduction avatar radrow avatar cytadela8 avatar rvirding avatar skkw avatar jsnewby avatar seanhinde avatar tolbrino avatar dincho avatar thomasaerts avatar johnsnewby avatar sennui avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.