markdown -> org mode

Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
Ava Hahn 2023-01-21 14:53:55 -08:00
parent be73b0b828
commit d296eb4510
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
4 changed files with 140 additions and 55 deletions

View file

@ -1,23 +0,0 @@
# Configuration
By default Relish will read from `~/.relishrc` for configuration, but the default shell will also accept a filename from the `RELISH_CFG_FILE` environment variable.
## The configuration file
The configuration file is a script containing arbitrary Relish code. On start, any shell (including the default shell) which leverages the configuration code in [the config module](src/config.rs) will create a clean seperate context, including default configuration values, within which the standard library will be initialized and the configuration file will be run. Afterwards, configuration values found in the variable map will be used to configure the standard library function mappings that the fully functional user shell will leverage. Errors during configuration are non-terminal and will result in default values being returned
#### Important points to note
- When the configuration file is run, it will be run with default configuration values.
- The user/script interpreter will be run with a *re-instantiation* of the standard library, using the previously defined configuration variables
- Variables and functions defined during configuration will carry over to the user/script interpreter, allowing the user to load any number of custom functions and variables.
## Configuration Values
The following are important variables that will determine the runtime behavior of the default shell or standard library functions:
| Variable | Default Value | Explanation |
|-|-|-|
| CFG_RELISH_POSIX | 0 | When on, enables POSIX style job control. [more information.](shell.md) |
| CFG_RELISH_ENV | 1 | When on, variables defined will be synchronized with environment variables. |
| CFG_RELISH_PROMPT | (echo "λ ") | *note: this is a function not a variable*. This function will be called to output the prompt each time the REPL loops. |
#### Specific Behaviors
- CFG_RELISH_POSIX is only loaded once and will be ignored after initial configuration.

View file

@ -1,29 +0,0 @@
# Relish
Rusty Expressive LIsp SHell
## Goals
Relish is a language meant to iterate on the ideas and designs that were tested with [SHS](https://gitlab.com/whom/shs). Relish acts as both as a high level scripting language and as a system shell. This language is meant to be practical for administrators and power users. Similar technologies include Python, Bash, and Racket.
## Current Status
- Core functionality (lexing, parsing, evaluation, function and variable tables) is complete and tested
- A primitive REPL is complete
### Pre-alpha release tasks
- Rudimentary control flow (if, loop, let)
- Variable declaration and environment integration
- Function declaration
- Shell module including foreground process, background process, and environment variable
- Stdlib including string operations, arithmetic operations, and file operations
- TESTS TESTS TESTS
## Configuration
[See docs here](CONFIGURING.md)
## Compilation
`$ cargo build`
## Testing
`$ cargo test`
## Running
`$ cargo run src/bin/main.rs`

137
Readme.org Normal file
View file

@ -0,0 +1,137 @@
#+Title: Relish: Rusty Expressive LIsp SHell
#+Author: Ava Hahn
* Purpose statement
The purpose of Relish is to create a highly expressive POSIX shell using a lisp interpreter.
* Goals
** Iterate on the ideas and designs that were tested with SHS
https://gitlab.com/whom/shs
** Act as both a high level scripting language and as a system shell
** To be as portable as possible
** To provide code and framework that can be embedded in other applications needing a user facing interpreter
** To be well tested code
* Current Status
*** DONE Core interpreter stuffs
**** DONE Lexing
**** DONE Parsing
**** DONE Evaluation
**** DONE Function table
**** DONE Variable table
*** TODO Rudimentary Control Flow
**** TODO if clause
**** TODO loop clause
**** TODO while clause
**** TODO circuit clause
*** TODO Configuration
*** TODO User variable declaration
*** TODO User function declaration
*** TODO Shell module
**** TODO Process launching with environment variables
**** TODO Foreground process TTY
**** TODO Background processes
*** TODO Custom error printing
*** TODO STDLIB
**** DONE append
**** TODO string operations
***** DONE concatenate
***** TODO substr by index
***** TODO tokenize by delimiter
***** TODO sprintf / string build
**** TODO arithmetic operations
***** TODO
**** TODO Serialize/Deserialize basic data types
**** TODO file opterations
***** TODO
**** TODO Network library
***** TODO HTTP Client
***** TODO TCP Stream client
***** TODO UDP Client
***** TODO TCP Listener
***** TODO HTTP Listener
***** TODO UDP Listener
*** TODO Ensure full test coverage
* Contact
** Matrix chat: #vomitorium:matrix.sunnypup.io
https://matrix.to/#/#vomitorium:matrix.sunnypup.io
* How to use
** Configuration
By default Relish will read from ~/.relishrc for configuration, but the default shell will also accept a filename from the RELISH_CFG_FILE environment variable.
*** The configuration file
The configuration file is a script containing arbitrary Relish code.
On start, any shell which leverages the configuration code in [the config module](src/config.rs) will create a clean seperate context, including default configuration values, within which the standard library will be initialized.
The configuration file is evaluated and run as a standalone script and may include arbitrary executable code. Afterwards, configuration values found in the variable map will be used to configure the standard library function mappings that the shell will use.
Errors during configuration are non-terminal and will result in default values being returned.
**** Important points to note
***** When the configuration file is run, it will be run with default configuration values.
***** The user/script interpreter will be run with a *re-instantiation* of the standard library, using the previously defined configuration variables.
***** Variables and functions defined during configuration will carry over to the user/script interpreter, allowing the user to load any number of custom functions and variables.
*** Configuration Values
**** CFG_RELISH_POSIX (default 0): when on, enables POSIX style job control.
**** CFG_RELISH_ENV (default 1): when on, interpreter's variable table and environment variable table are kept in sync.
**** CFG_RELISH_PROMPT (default (echo "λ ")): A *function* definition which is called in order to output the prompt for each loop of the REPL.
Note: CFG_RELISH_PROMPT is only loaded once and will be ignored after initial configuration.
** Compilation
#+BEGIN_SRC sh
cargo build
#+END_SRC
** Testing
#+BEGIN_SRC sh
cargo test
#+END_SRC
** Running (the main shell)
#+BEGIN_SRC sh
cargo run src/bin/main.rs
#+END_SRC
* Guide to codebase
** file:tests directory
Start here if you are new.
Most of these files have unimplemented tests commented out in them.
Contributions that help fill out all of these tests
*** Eval tests: file:tests/test_eval.rs
These are particularly easy to read and write tests.
*** Func tests: file:tests/test_func.rs
You can consider these to extend the eval tests to cover the co-recursive nature between eval and func calls.
*** Lex tests: file:tests/test_lex.rs
These tests verify the handling of syntax.
*** Lib tests: (tests/test_lib*)
These tests are unique per stdlib module.
** file:src directory
This directory contains all of the user facing code in relish.
Just a few entries of note:
*** segment: file:src/segment.rs
This file lays out the +spiritual+ +theological+ +ideological+ +theoretical+ mechanical underpinnings of the entire interpreter.
The entire LISP machine centers around a singlet or pairing of datum.
The ~Ctr~ datatype provides an abstraction for which any type of data, including a ~Seg~ can be a datum.
The ~Seg~ datatype provides a mechanism to hold a single datum or a pair of datum. It is implemented as two ~Ctr~s: ~car~ and ~cdr~.
A primitive type system is provided through the Rust Enum datatype. A number of utility functions follow.
*** lib: file:src/lib.rs
This defines a library that can be included to provide an interpreter interface within any Rust project.
It includes the core interpreter mechanisms, full stdlib, and the configuration system.
Your project can use or not use any number of these components. They can certainly be used to support language development for other LISP machines,
or even other languages.
*** stl: file:src/stl.rs
This defines the ~get_stdlib~ function.
This function takes in a Variable Table (likely containing custom configuration) and returns a Function Table for use in an interpreter.
Any new addition to the stdlib must make its way here to be included in the main shell (and any other shell using the included ~get_stdlib~ function).
You may choose to override this function if you would like to include your own special functions in your own special interpreter, or if you would like to pare down the stdlib to a small minimal subet of what it is.
*** bin: file:src/bin/
This contains any executable target of this project. Notably the main shell file:src/bin/main.rs.

View file

@ -164,7 +164,7 @@ mod eval_tests {
/* /*
#[test] #[test]
fn eval_bad_vars() { fn eval_bad_vars() {
let test_doc = "1".to_string(); let test_doc = "".to_string();
let ft = Rc::new(RefCell::new(FTable::new())); let ft = Rc::new(RefCell::new(FTable::new()));
let vt = Rc::new(RefCell::new(VTable::new())); let vt = Rc::new(RefCell::new(VTable::new()));
@ -191,7 +191,7 @@ mod eval_tests {
#[test] #[test]
fn eval_bad_func() { fn eval_bad_func() {
let test_doc = "1".to_string(); let test_doc = "".to_string();
let ft = Rc::new(RefCell::new(FTable::new())); let ft = Rc::new(RefCell::new(FTable::new()));
let vt = Rc::new(RefCell::new(VTable::new())); let vt = Rc::new(RefCell::new(VTable::new()));
@ -218,7 +218,7 @@ mod eval_tests {
#[test] #[test]
fn eval_verify_all_elems_cloned() { fn eval_verify_all_elems_cloned() {
let test_doc = "1".to_string(); let test_doc = "".to_string();
let ft = Rc::new(RefCell::new(FTable::new())); let ft = Rc::new(RefCell::new(FTable::new()));
let vt = Rc::new(RefCell::new(VTable::new())); let vt = Rc::new(RefCell::new(VTable::new()));