readme update
This commit is contained in:
parent
906949d691
commit
35ca9c31ea
1 changed files with 43 additions and 23 deletions
60
README.md
60
README.md
|
@ -13,7 +13,8 @@ I didn't really study how others languages works beforehand, I'm just guessing h
|
|||
|
||||
## 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:
|
||||
|
||||
|
@ -27,24 +28,34 @@ ToDo List:
|
|||
- [X] read line comments
|
||||
- [ ] add modulus operator '%'
|
||||
- [ ] implement input_number()
|
||||
- [ ] base of the CLI
|
||||
- [X] base of the CLI
|
||||
- [ ] evaluate expression from stdin
|
||||
- [ ] read a file
|
||||
- [ ] if statements
|
||||
- [ ] while statements (with break)
|
||||
- [X] read a file
|
||||
- [X] if statements
|
||||
- [ ] while statements (with break and continue)
|
||||
- [ ] add functions support
|
||||
- [ ] add config header file
|
||||
- [ ] ability to modify keywords and customize the lang
|
||||
- [ ] add strings support
|
||||
- [ ] add list support
|
||||
- [ ] add static string support (just for ui)
|
||||
- [ ] 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
|
||||
|
||||
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.
|
||||
|
||||
### Comments
|
||||
|
@ -55,12 +66,18 @@ Can only use single line comments with `#`
|
|||
# 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
|
||||
|
||||
can only operate on integer
|
||||
|
||||
function calls: func(arg_a, arg_b)
|
||||
operators: +, *, /, ^
|
||||
operators: +, *, /, ^, %, =, <, >, &, |, !
|
||||
|
||||
### Set a variable
|
||||
|
||||
|
@ -68,17 +85,16 @@ operators: +, *, /, ^
|
|||
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 {NAME}
|
||||
begin
|
||||
function {NAME} do
|
||||
...
|
||||
end
|
||||
```
|
||||
|
@ -87,7 +103,6 @@ end
|
|||
|
||||
```
|
||||
if {EXPRESSION} then
|
||||
begin
|
||||
...
|
||||
end
|
||||
```
|
||||
|
@ -96,7 +111,6 @@ end
|
|||
|
||||
```
|
||||
while {EXPRESSION} do
|
||||
begin
|
||||
...
|
||||
end
|
||||
```
|
||||
|
@ -104,9 +118,14 @@ end
|
|||
### Unconditional loop
|
||||
|
||||
```
|
||||
repeat {EXPRESSION THAT EVALUATE TO INT}
|
||||
begin
|
||||
repeat {INT EXPRESSION} do
|
||||
...
|
||||
end
|
||||
```
|
||||
|
||||
```
|
||||
repeat i from {INT EXPRESSION} to {INT EXPRESSION} do
|
||||
...
|
||||
end
|
||||
```
|
||||
|
||||
|
@ -118,6 +137,7 @@ sqrt,sin,cos,exp,ln,log etc.
|
|||
print_number(data)
|
||||
input_number()
|
||||
random_int(min, max)
|
||||
random_float(min, max)
|
||||
```
|
||||
|
||||
# Evaluator (draft)
|
||||
|
|
Loading…
Reference in a new issue