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:
parent
d7fa4d65ec
commit
83e03f3013
11
README.md
11
README.md
@ -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.
|
||||
|
||||
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
|
||||
[the æternity node](https://github.com/aeternity/epoch). However, it can
|
||||
also be included in other systems to compile contracts coded in sophia which
|
||||
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
|
||||
|
||||
`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
|
||||
API changes etc.
|
||||
|
||||
|
||||
## Interface Modules
|
||||
|
||||
The basic modules for interfacing the compiler:
|
||||
|
1064
docs/sophia.md
Normal file
1064
docs/sophia.md
Normal file
File diff suppressed because it is too large
Load Diff
1845
docs/sophia_stdlib.md
Normal file
1845
docs/sophia_stdlib.md
Normal file
File diff suppressed because it is too large
Load Diff
@ -62,17 +62,13 @@ namespace Frac =
|
||||
else simplify(Neg(abs_int(n), abs_int(d)))
|
||||
|
||||
function eq(a : frac, b : frac) : bool =
|
||||
let na = num(a)
|
||||
let nb = num(b)
|
||||
let da = den(a)
|
||||
let db = den(b)
|
||||
let (na, da) = to_pair(a)
|
||||
let (nb, db) = to_pair(b)
|
||||
(na == nb && da == db) || na * db == nb * da // they are more likely to be normalized
|
||||
|
||||
function neq(a : frac, b : frac) : bool =
|
||||
let na = num(a)
|
||||
let nb = num(b)
|
||||
let da = den(a)
|
||||
let db = den(b)
|
||||
let (na, da) = to_pair(a)
|
||||
let (nb, db) = to_pair(b)
|
||||
(na != nb || da != db) && na * db != nb * da
|
||||
|
||||
function geq(a : frac, b : frac) : bool = num(a) * den(b) >= num(b) * den(a)
|
||||
@ -131,10 +127,8 @@ namespace Frac =
|
||||
else cl
|
||||
|
||||
function add(a : frac, b : frac) : frac =
|
||||
let na = num(a)
|
||||
let nb = num(b)
|
||||
let da = den(a)
|
||||
let db = den(b)
|
||||
let (na, da) = to_pair(a)
|
||||
let (nb, db) = to_pair(b)
|
||||
if (da == db) make_frac(na + nb, da)
|
||||
else make_frac(na * db + nb * da, da * db)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user