comments support, script loading support

This commit is contained in:
Aidan 2020-07-15 18:41:54 -07:00
parent 654e8bd55b
commit bd22b84699
No known key found for this signature in database
GPG key ID: 327711E983899316
11 changed files with 145 additions and 69 deletions

View file

@ -49,6 +49,10 @@ See `stdlib/control_flow.go`. We have if and while forms:
We also have functioning implementations of map and reduce in the stdlib (incomplete)
## Comments
The standard delimiter for comments is ;
any characters after a semicolon will be ignored until end of line
## How to build
### Compiling/Installation
- For now simply run `go install cmd/...` for each utility you wish to use. If you have GOPATH and GOBIN set it should be usable from PATH
@ -69,9 +73,14 @@ We also have functioning implementations of map and reduce in the stdlib (incomp
* one can write arbitrary shs script into `.shsrc` including function and variable declarations
* of note are the following variables
- `SH_LOGGING` Sets the log level (from 0 to 3)
- `SHS_SH_PROMPT` Sets the prompt
- `SHS_STATIC_PROMPT` Sets the prompt
- `SH_HIST_FILE` Sets the history file
- `SH_DEBUG_MODE` Adds additional debug output for the lexer
- `SH_DEBUG_MODE` Adds additional debug output for the lexer (high clutter)
* additionally, the repl will evaluate any function you define as `_SH_PROMPT` before the shell prompt
- if defined, the function will be evaluated before printing the prompt
- the function will be given 0 arguments
- if the function does not return a string, its output will be discarded
- afterwards, the repl will print the values in `SHS_STATIC_PROMPT`
Here is an example of a shs configuration file:
```lisp
(export GOPATH (concat HOME "/go"))
@ -80,6 +89,8 @@ Here is an example of a shs configuration file:
(export GIT_TERMINAL_PROMPT 1)
(export SH_HIST_FILE (concat HOME "/.shs_hist"))
(export SH_LOGGING 0)
(export SHS_STATIC_PROMPT ">")
(func _SH_PROMPT () (concat (?) ($ basename ($ pwd)) "\n"))
```
## Contributing