Added documentation (#239)

* Added documentation

* Update readme

* Update readme

* Format fix

* Events

* Stdlib mention

* Frac doc

* Frac doc comparison warning

* Typos

* Format fix, TOC added

* Fixed link

* Update editor message

* Split TOC

* Moved out AEVM ABI

* Minor format

Co-Authored-By: Hans Svensson <hanssv@gmail.com>

* Typo

Co-Authored-By: Hans Svensson <hanssv@gmail.com>

* Grammar

Co-Authored-By: Hans Svensson <hanssv@gmail.com>

* Language

Co-authored-by: Hans Svensson <hanssv@gmail.com>
This commit is contained in:
Radosław Rowicki 2020-03-10 12:39:39 +01:00 committed by GitHub
parent d7fa4d65ec
commit 83e03f3013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2924 additions and 14 deletions

View File

@ -2,13 +2,19 @@
This is the __sophia__ compiler for the æternity system which compiles contracts written in __sophia__ code to the æternity VM code. This is the __sophia__ compiler for the æternity system which compiles contracts written in __sophia__ code to the æternity VM code.
For more information about æternity smart contracts and the sophia language see [Smart Contracts](https://github.com/aeternity/protocol/blob/master/contracts/contracts.md) and the [Sophia Language](https://github.com/aeternity/protocol/blob/master/contracts/sophia.md).
It is an OTP application written in Erlang and is by default included in It is an OTP application written in Erlang and is by default included in
[the æternity node](https://github.com/aeternity/epoch). However, it can [the æternity node](https://github.com/aeternity/epoch). However, it can
also be included in other systems to compile contracts coded in sophia which also be included in other systems to compile contracts coded in sophia which
can then be loaded into the æternity system. can then be loaded into the æternity system.
## Documentation
* [Smart Contracts on aeternity Blockchain](https://github.com/aeternity/protocol/blob/master/contracts/contracts.md).
* [Sophia Documentation](docs/sophia.md).
* [Sophia Standard Library](docs/sophia_stdlib.md).
## Versioning ## Versioning
`aesophia` has a version that is only loosely connected to the version of the `aesophia` has a version that is only loosely connected to the version of the
@ -17,6 +23,7 @@ minor/patch version. The `aesophia` compiler version MUST be bumped whenever
there is a change in how byte code is generated, but it MAY also be bumped upon there is a change in how byte code is generated, but it MAY also be bumped upon
API changes etc. API changes etc.
## Interface Modules ## Interface Modules
The basic modules for interfacing the compiler: The basic modules for interfacing the compiler:

1064
docs/sophia.md Normal file

File diff suppressed because it is too large Load Diff

1845
docs/sophia_stdlib.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -62,17 +62,13 @@ namespace Frac =
else simplify(Neg(abs_int(n), abs_int(d))) else simplify(Neg(abs_int(n), abs_int(d)))
function eq(a : frac, b : frac) : bool = function eq(a : frac, b : frac) : bool =
let na = num(a) let (na, da) = to_pair(a)
let nb = num(b) let (nb, db) = to_pair(b)
let da = den(a)
let db = den(b)
(na == nb && da == db) || na * db == nb * da // they are more likely to be normalized (na == nb && da == db) || na * db == nb * da // they are more likely to be normalized
function neq(a : frac, b : frac) : bool = function neq(a : frac, b : frac) : bool =
let na = num(a) let (na, da) = to_pair(a)
let nb = num(b) let (nb, db) = to_pair(b)
let da = den(a)
let db = den(b)
(na != nb || da != db) && na * db != nb * da (na != nb || da != db) && na * db != nb * da
function geq(a : frac, b : frac) : bool = num(a) * den(b) >= num(b) * den(a) function geq(a : frac, b : frac) : bool = num(a) * den(b) >= num(b) * den(a)
@ -131,10 +127,8 @@ namespace Frac =
else cl else cl
function add(a : frac, b : frac) : frac = function add(a : frac, b : frac) : frac =
let na = num(a) let (na, da) = to_pair(a)
let nb = num(b) let (nb, db) = to_pair(b)
let da = den(a)
let db = den(b)
if (da == db) make_frac(na + nb, da) if (da == db) make_frac(na + nb, da)
else make_frac(na * db + nb * da, da * db) else make_frac(na * db + nb * da, da * db)