readme update

This commit is contained in:
Matthieu Bessat 2022-05-15 19:58:52 +02:00
parent 906949d691
commit 35ca9c31ea

View file

@ -13,7 +13,8 @@ I didn't really study how others languages works beforehand, I'm just guessing h
## Progress ## Progress
- 2022-04-29 : Implementation of a basic evaluator engine to evaluate arithmetic expressions and call functions - 2022-04-29 Implementation of a basic evaluator engine to evaluate arithmetic expressions and call functions
- 2022-05-15 Clear progress being able to use simple while and if though thre are many glitches
ToDo List: ToDo List:
@ -27,24 +28,34 @@ ToDo List:
- [X] read line comments - [X] read line comments
- [ ] add modulus operator '%' - [ ] add modulus operator '%'
- [ ] implement input_number() - [ ] implement input_number()
- [ ] base of the CLI - [X] base of the CLI
- [ ] evaluate expression from stdin - [ ] evaluate expression from stdin
- [ ] read a file - [X] read a file
- [ ] if statements - [X] if statements
- [ ] while statements (with break) - [ ] while statements (with break and continue)
- [ ] add functions support - [ ] add functions support
- [ ] add config header file - [ ] add config header file
- [ ] ability to modify keywords and customize the lang - [ ] ability to modify keywords and customize the lang
- [ ] add strings support - [ ] add static string support (just for ui)
- [ ] add list support - [ ] add print_string function
- [ ] add basic number list support
- [ ] add fully features strings support
- [ ] add [classic problem solving](https://rosettacode.org) with code examples
## Installation
You will need to compile the code from source.
- Clone this repository
- Then compile (eg. with `make`)
I use GNU Make with GCC, but I'm sure you can use any C compilers though you may need to edit some part of the code to cope with other compilers (eg. binary constants).
## The language ## The language
You would be able to use the lang directly via CLI, via a REPL or by writing in a file (file ext `.ltor`). You would be able to use the lang directly via CLI, via a REPL or by writing in a file (file ext `.ltor`).
To begin with and order to simplify things we would only have numbers as datatypes (so an abstraction with int or float under the hood).
One instruction set per line. One instruction set per line.
### Comments ### Comments
@ -55,12 +66,18 @@ Can only use single line comments with `#`
# this is a comment # this is a comment
``` ```
### Data types
To begin with and order to simplify things we would only have numbers as datatypes.
When a variable is declared it can be 32 bit integer or 32 bit float.
The language may support strings literals in the future.
### Expression evaluation ### Expression evaluation
can only operate on integer
function calls: func(arg_a, arg_b) function calls: func(arg_a, arg_b)
operators: +, *, /, ^ operators: +, *, /, ^, %, =, <, >, &, |, !
### Set a variable ### Set a variable
@ -68,18 +85,17 @@ operators: +, *, /, ^
set {VARNAME} to {EXPRESSION} set {VARNAME} to {EXPRESSION}
``` ```
### Eval an expression without using the result ### Evaluate an expression without using the result
``` ```
eval print_number(42) print_number(42)
``` ```
### function definition ### function definition
``` ```
function {NAME} function {NAME} do
begin ...
...
end end
``` ```
@ -87,8 +103,7 @@ end
``` ```
if {EXPRESSION} then if {EXPRESSION} then
begin ...
...
end end
``` ```
@ -96,17 +111,21 @@ end
``` ```
while {EXPRESSION} do while {EXPRESSION} do
begin ...
...
end end
``` ```
### Unconditional loop ### Unconditional loop
``` ```
repeat {EXPRESSION THAT EVALUATE TO INT} repeat {INT EXPRESSION} do
begin ...
end
```
```
repeat i from {INT EXPRESSION} to {INT EXPRESSION} do
...
end end
``` ```
@ -118,6 +137,7 @@ sqrt,sin,cos,exp,ln,log etc.
print_number(data) print_number(data)
input_number() input_number()
random_int(min, max) random_int(min, max)
random_float(min, max)
``` ```
# Evaluator (draft) # Evaluator (draft)