langatator/README.md

83 lines
1.1 KiB
Markdown
Raw Normal View History

2022-04-20 18:10:00 +00:00
# Simple BASIC language implementation
The goal of this project is to create a simple implementation of a BASIC-like language.
No need to do complex thing, just to create a simple interpreted language that can be used to do some arithmetics
and create for ex a number guessing game.
## Technology
We will create our own regex engine
## Syntax
One instruction set per line
Instruction sets avalaibles:
### Commentary
can only use single line comments with `#`
```
# this is a comment
```
### Expression evaluation
can only operate on integer
function calls: func(arg_a, arg_b)
operators: +, *, /
booleans operators: not, and, or,
### function definition
```
function {NAME}
begin
...
end
```
### Set a variable
```
set {VARNAME} to {EXPRESSION}
```
### Conditional structure
```
if {EXPRESSION} then
begin
...
end
```
### Conditional loop
```
while {EXPRESSION} do
begin
...
end
```
### Unconditional loop
```
repeat {EXPRESSION THAT EVALUATE TO INT}
begin
end
```
### std functions
```
put_stdout()
take_stdin()
int_of_string()
random_int(min, max)
```