add a readme

This commit is contained in:
David 2021-02-21 12:22:08 -05:00
parent 0676cad34d
commit 6c5df444da
1 changed files with 59 additions and 0 deletions

59
README.md Normal file
View File

@ -0,0 +1,59 @@
# Prosper
Prosper is a Forth-like stack-based language. While taking specific influence from Forth, it does not attempt to emulate or implement the ANS Forth standards.
Currently, the language is entirely interactive -- to explore, simply run `go run .` in the root of this project and an interactive session will begin.
## Syntax
Prosper is stack-based, as mentioned, so all the standard stack semantics are present:
```
> 1 2 3 4 + * -
ok
> .
-13 ok
```
New words can be defined using `: ;`:
```
> : SQUARE DUP * ;
ok
> 10 SQUARE .
100 ok
```
It has a single loop construct, `DO LOOP`:
```
> : TOFIVE 5 0 DO I . LOOP ;
ok
> TOFIVE
0 1 2 3 4 ok
```
Branches using `IF ELSE THEN` work:
```
> : EMOJI 0 < IF 128201 EMIT ELSE 128200 EMIT THEN ;
ok
> 100 EMOJI
📈 ok
> -100 EMOJI
📉 ok
```
And, of course, it knows how to quit:
```
> BYE
bye
```
## Future Plans
* Implement `VARIABLE` and `CONSTANT` and the various `? ! @` related words
* Implement `SEE`
* Implement loading libraries of pre-written functions both from the command-line and at run-time
* Add much better readline behaviors in the interactive console (up-arrow for history, cursor movement...)