Merge branch 'main' of git.vanten-s.com:vanten-s/plonkus

This commit is contained in:
vanten 2023-09-30 22:14:21 +02:00
commit 97c940ba65
Signed by: vanten-s
GPG key ID: DE3060396884D3F2
2 changed files with 45 additions and 1 deletions

44
README.md Normal file
View file

@ -0,0 +1,44 @@
# Plonkus
## About
This is a small hobby language that I created because I was bored.
It only supports [my own architecture](https://github.com/vanten-s/8bit-computer) but I'm planning to extend it to x86 some day.
## Features
Currently the language has the following
- Expressions
- Scopes
- Functions
- Variables
But more features like
- If statements
- Loops
- Function calls in expressions
- Comments
Are coming.
## Syntax
Here is example of functions, built-ins and variables and Scopes
```plonkus
fn main {
let a = 2;
{
let a = a + 1;
out(a);
}
test(a);
exit();
};
fn test output {
let numberToOutput = output;
out(numberToOutput);
};
```
This code prints 3 and then 2.

View file

@ -310,7 +310,7 @@ impl Node for Expression {
} }
let stack_position = state.variables.len() let stack_position = state.variables.len()
- state.variables.iter().position(|x| x == name).unwrap() - state.variables.iter().rposition(|x| x == name).unwrap()
- 1; - 1;
dbg!(&state.variables); dbg!(&state.variables);