docs first version
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# Imports
|
||||
|
||||
## Module System
|
||||
|
||||
| Mnemonic | Syntax | Description |
|
||||
|----------|--------|-------------|
|
||||
| **INCLUDE** | `alias[:] "path"` | Include module symbols |
|
||||
|
||||
## Import Precedence
|
||||
|
||||
**Notes:**
|
||||
- The order of imports may affect the order in which dependencies are placed into the output binary.
|
||||
- Circular dependencies are allowed and fully supported.
|
||||
- The module name is caller-defined and can be used to create aliases for libraries within the scope of the calling file. This makes namespacing easy.
|
||||
|
||||
**Examples:**
|
||||
```dsa
|
||||
include print "./lib/print.dsa"
|
||||
include maths "./lib/maths.dsa"
|
||||
```
|
||||
|
||||
## External Symbol Access Convention
|
||||
|
||||
External symbols are accessed using the `::` operator.
|
||||
|
||||
**Examples:**
|
||||
|
||||
```dsa
|
||||
include print "./lib/print.dsa"
|
||||
|
||||
init:
|
||||
// ensure we have a stack setup so we can call functions properly
|
||||
|
||||
db string: "Hello world!"
|
||||
|
||||
start:
|
||||
// load the address of the string into rg1.
|
||||
lwi string, rg1
|
||||
// push the string address argument
|
||||
push rg1
|
||||
// call the print function
|
||||
call print::print
|
||||
// clean up the stack
|
||||
pop zero
|
||||
hlt
|
||||
```
|
||||
Reference in New Issue
Block a user