Redifine specs
This commit is contained in:
parent
a66fcd3dab
commit
bd13458eab
1 changed files with 38 additions and 22 deletions
60
README.md
60
README.md
|
@ -1,34 +1,50 @@
|
|||
# q-lang
|
||||
# Q-LANG
|
||||
|
||||
Idea by [@thea@eldritch.cafe](https://eldritch.cafe/@thea).
|
||||
You can code only using the letter `q`.
|
||||
|
||||
`q-pilator` (WIP) is the interpreter/compiler
|
||||
|
||||
## Project structure
|
||||
|
||||
The project is entirely made of `q` directories and files, each `q` file contain a number of `q` that determine instructions.
|
||||
instruction are executed in order `q -> qq -> ..`
|
||||
- `q-pilator` (WIP) is the interpreter/compiler
|
||||
- `q-pidon` (WIP) is the code generator
|
||||
|
||||
## Glossary
|
||||
## Language spec
|
||||
|
||||
| symbol | interpretation |
|
||||
| ------ | -------------- |
|
||||
| `q` | read registry |
|
||||
| `qq` | declare registry |
|
||||
| `qqq` | call function |
|
||||
| `qqqq` | declare function |
|
||||
| `qqqqq` | operator |
|
||||
Q-lang is a single threaded language, code is written on using `q-dir` and `q-file` sequentially (`q -> qq -> qqq`).
|
||||
|
||||
### Type declaration
|
||||
A `q-dir` contain at least a `q-file` named `q` and can contain an arbitrairy number of `q-dir` and `q-file`
|
||||
|
||||
when encountering thoose symbol `qpilator` will check a directory with the same name + `q` to find the value
|
||||
A `q-file`can contain either an data or instruction.
|
||||
|
||||
| symbol | interpretation | range | method |
|
||||
| ------- | -------------- | ----- | ---- |
|
||||
| `q` | bool | true - false | single file
|
||||
| `qq` | uint | 0 .. 255 | single file
|
||||
| `qqq` | int | -127 .. 128 | single file
|
||||
| `qqqq` | string | [a-zA-Z] | one file per char* |
|
||||
Instruction is always implied.
|
||||
|
||||
*qqqq -string : `empty = a, ..., 25q = z, 26q = A, ..., 51q = Z`
|
||||
### Glossary
|
||||
|
||||
- $f$ is a file
|
||||
- $dir$ a directory
|
||||
- $...$ meaning repeating
|
||||
|
||||
A scope refference the curent execution calling a function make the scope local to this function meaning once the call end memory is cleared.
|
||||
|
||||
#### Instruction
|
||||
|
||||
| number of $q$ | INSTRUCT | ARGs | Structure | Details
|
||||
| --- | --- | --- | --- | --- |
|
||||
| 0 | STDOUT | DATA |
|
||||
| 1 | WRITE VAR | name - scope - DATA | $f,f,dir$
|
||||
| 2 | READ VAR | name | $f$ |
|
||||
| 3 | FUNCTION | name | $dir$ | function are always using the smalest scope possible
|
||||
| 4 | CALL | name - DATA | $f, dir$ |
|
||||
|
||||
#### DATA
|
||||
|
||||
Data type are always prefixed by a `q-file` containing type info (number of $q$).
|
||||
|
||||
| number of $q$ | Type | Structure | Details
|
||||
| --- | --- | --- | --- |
|
||||
| 0 | boolean | $f$ | bool
|
||||
| 1 | unsigned int | $f$ | u32
|
||||
| 2 | signed int | $f,f$ | i16
|
||||
| 3 | char | $f$ | [ASCII](https://www.ascii-code.com/)
|
||||
| 4 | array | $dir \rightarrow (f,data...)$ | u16
|
||||
| 5 | exec | $dir \rightarrow$ `INSTRUCTs` | `exec` return the data contain in the first cell of the local registry |
|
Loading…
Add table
Add a link
Reference in a new issue