rename relish to flesh

This commit is contained in:
Ava Apples Affine 2024-02-06 22:39:08 +00:00
parent 415b1181fa
commit 9b447eb5b7
58 changed files with 252 additions and 245 deletions

View file

@ -22,7 +22,7 @@ compile-release:
- cargo build --release
artifacts:
paths:
- target/release/relish
- target/release/flesh
only:
variables:
- $CI_COMMIT_TAG =~ /^v\d+.\d+.\d+-?.*$/
@ -37,4 +37,4 @@ unit-tests:
userlib-tests:
stage: test
script:
- cargo run --no-default-features snippets/userlib.rls snippets/userlib-tests.rls
- cargo run --no-default-features snippets/userlib.f snippets/userlib-tests.f

View file

@ -1,6 +1,6 @@
[package]
name = "relish"
version = "0.3.0"
name = "flesh"
version = "0.4.0"
authors = ["Ava <ava@sunnypup.io>"]
edition = "2021"

View file

@ -1,10 +1,10 @@
#+Title: Relish: Rusty Expressive LIsp SHell
#+Author: Ava Hahn
#+Title: Flesh: Flexible Shell
#+Author: Ava Affine
Note: this document is best read using a dedicated ORG mode editor
* Purpose statement
The purpose of Relish is to create a highly portable, easy to integrate language that can be used in many environments.
The purpose of Flesh is to create a highly portable, easy to integrate language that can be used in many environments.
* Goals
- Iterate on the ideas and designs that were tested with [[https://gitlab.com/whom/shs][SHS]]
@ -14,7 +14,7 @@ The purpose of Relish is to create a highly portable, easy to integrate language
- No unsafe code nessesary
Note: as of release 0.3.0, the Posix module requires unsafe code in order to interface with libc.
Users are still able to compile and use Relish without any of the unsafe code involved by removing
Users are still able to compile and use Flesh without any of the unsafe code involved by removing
the POSIX module. See the Compilation section for more details.
** Stretch Goals
@ -25,31 +25,32 @@ The purpose of Relish is to create a highly portable, easy to integrate language
* Contact
[[https://matrix.to/#/#relish:matrix.sunnypup.io][Matrix chat: #relish:matrix.sunnypup.io]]
If you like Relish and want to support me in working on it consider donating: [[https://ko-fi.com/avaaffine][Ava's Ko-Fi]].
If you like Flesh and want to support me in working on it consider donating: [[https://ko-fi.com/avaaffine][Ava's Ko-Fi]].
* Documentation
** Writing in Relish
Users who are new to Relish, or who are seeking documentation on how to effectively write in Relish should reference [[file:Writing.org][the main language documentation]]. This will go over the following:
- How Relish operates under the hood
- Relish's syntax
- Relish control flow constructs
** Writing in Flesh
Users who are new to Flesh, or who are seeking documentation on how to effectively write in Flesh should reference [[file:Writing.org][the main language documentation]]. This will go over the following:
- How Flesh operates under the hood
- Flesh syntax
- Flesh control flow constructs
- Stdlib functions
- Builting documentation
- Common patterns in using Relish
** Using Relish as your shell
As of version 0.3.0 Relish implements all the features of an interactive shell.
- Common patterns in using Flesh
** Using Flesh as your shell
As of version 0.3.0 Flesh implements all the features of an interactive shell.
See further documentation in [[file:Shell.org][the shell documentation]]. This material goes over the following:
- How to start and view jobs in Relish
- How to start and view jobs in Flesh
- Special forms for modifying the file descriptors of new jobs
- Piping and other special shell control flow
- Special snippets used to provide a first class shell experience
* 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.
See [[file:snippets/basic_minimal_configuration.rls][the minimal shell configuration example]] for an example of a basic configuration file.
By default Flesh will read from ~/.fleshrc for configuration, but the default shell will also accept a filename from the FLESH_CFG_FILE environment variable.
See [[file:snippets/basic_minimal_configuration.f][the minimal shell configuration example]] for an example of a basic configuration file.
Other snippets, including mood-prompt and avas-laptop-prompt demonstrate more complex configurations.
** The configuration file
The configuration file is a script containing arbitrary Relish code.
The configuration file is a script containing arbitrary Flesh code.
On start, any shell which leverages the configuration code in the config module ([[file:src/run.rs][run.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.
@ -62,54 +63,54 @@ Errors during configuration are non-terminal. In such a case any defaults which
- 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 true): when true, enables POSIX style job control and shell features.
- CFG_RELISH_ENV (default true): when true, interpreter's variable table and environment variable table are kept in sync.
- CFG_RELISH_L_PROMPT (default 'λ'): a function that is called with no arguments to output the left hand of the prompt
- CFG_RELISH_R_PROMPT (default ''): a function that is called with no arguments to output the right hand of the prompt
- CFG_RELISH_PROMPT_DELIMITER (default '>'): a function that is called with no arguments to output the delimiter separating prompt from user input
- CFG_FLESH_POSIX (default true): when true, enables POSIX style job control and shell features.
- CFG_FLESH_ENV (default true): when true, interpreter's variable table and environment variable table are kept in sync.
- CFG_FLESH_L_PROMPT (default 'λ'): a function that is called with no arguments to output the left hand of the prompt
- CFG_FLESH_R_PROMPT (default ''): a function that is called with no arguments to output the right hand of the prompt
- CFG_FLESH_PROMPT_DELIMITER (default '>'): a function that is called with no arguments to output the delimiter separating prompt from user input
** Prompt design
For an example of prompt design see [[file:snippets/mood-prompt.rls][the mood prompt]]
For a more complex example see [[file:snippets/avas-laptop-prompt.rls][Ava's laptop prompt]]
For an example of prompt design see [[file:snippets/mood-prompt.f][the mood prompt]]
For a more complex example see [[file:snippets/avas-laptop-prompt.f][Ava's laptop prompt]]
** Further configuration
Further configuration can be done by loading scripts that contain more functions and data to evaluate.
Variables and functions defined in an external script loaded by your interpreter will persist in the symbol table.
#+BEGIN_SRC lisp
(call "my-extra-library-functions.rls")
(call "my-extra-library-functions.f")
#+END_SRC
* Syntax Highlighting
Syntax Highlighting is implemented for Emacs under [[file:snippets/relish-mode.el][the Relish Mode module (snippets/relish-mode.el)]].
Syntax Highlighting is implemented for Emacs under [[file:snippets/flesh-mode.el][the Flesh Mode module (snippets/flesh-mode.el)]].
For installation, consider adding the following to your ~\~/.emacs~:
#+BEGIN_SRC el
(load-file "/PATH/TO/relish/snippets/relish-mode.el")
(load-file "/PATH/TO/flesh/snippets/flesh-mode.el")
#+END_SRC
* Compilation
Compiling Relish is as simple as kicking off a build with Cargo.
Compiling Flesh is as simple as kicking off a build with Cargo.
#+BEGIN_EXAMPLE sh
cargo build
#+END_EXAMPLE
This will produce a binary at [[file:target/debug/relish][target/debug/relish]] which includes all of the features relish has to offer. This provides a REPL with a full interactive shell that also can manage variables in the Unix environment. It is possible to compile a smaller REPL that does not interact with environment variables and does not offer any shell features. Simply pass the ~--no-default-features~ flag to cargo:
This will produce a binary at [[file:target/debug/flesh][target/debug/flesh]] which includes all of the features flesh has to offer. This provides a REPL with a full interactive shell that also can manage variables in the Unix environment. It is possible to compile a smaller REPL that does not interact with environment variables and does not offer any shell features. Simply pass the ~--no-default-features~ flag to cargo:
#+BEGIN_EXAMPLE sh
cargo build --no-default-features
#+END_EXAMPLE
In order to run Relish it is recommended to run the resulting binary at [[file:target/debug/relish][target/debug/relish]].
In order to run Flesh it is recommended to run the resulting binary at [[file:target/debug/flesh][target/debug/flesh]].
** Testing
Relish has upwards of 120 unit tests. Full functionality of the core AST with lex, parse, and eval routines as well as the symbol table and relevant code can be tested with Cargo. Unit tests are also included for the standard library of data manipulations and special cases around quote/eval and lambda use:
Flesh has upwards of 120 unit tests. Full functionality of the core AST with lex, parse, and eval routines as well as the symbol table and relevant code can be tested with Cargo. Unit tests are also included for the standard library of data manipulations and special cases around quote/eval and lambda use:
#+BEGIN_EXAMPLE sh
cargo test
#+END_EXAMPLE
Userlib tests can be triggered by loading the userlib as well as its test suite directly from a ~cargo run~ invocation:
#+BEGIN_EXAMPLE sh
cargo run snippets/userlib.rls snippets/userlib-tests.rls
cargo run snippets/userlib.f snippets/userlib-tests.f
#+END_EXAMPLE
* The codebase
@ -125,12 +126,12 @@ These tests verify the handling of syntax.
*** Lib tests: (tests/test_lib*)
These tests are unique per stdlib module and work to prove the functionality of builtin functions in the language.
** [[file:src][Source directory]]
This directory contains all of the user facing code in relish.
This directory contains all of the user facing code in flesh.
Just a few entries of note:
*** [[file:src/segment.rs][Segment module]]
This file lays out the data structures that the interpreter operates on.
Representation of code trees, traversals, and type annotations all live here.
It provides the core representation of data used in Relish, and could provide supplementary refrence material for users seeking a deeper understanding of how their code is stored in memory.
It provides the core representation of data used in Flesh, and could provide supplementary refrence material for users seeking a deeper understanding of how their code is stored in memory.
*** [[file:src/lib.rs][lib.rs]]
This defines a library that can be included to provide an interpreter interface within any Rust project.
The components defined here can certainly be used to support language development for other LISP (or non LISP) langauges. An external project may use or not use any number of these components.
@ -151,7 +152,7 @@ Any new addition to the stdlib must make its way here to be included in the main
You may choose to override these functions 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 lighter subet of what it is.
You can view the code for standard library functions in [[file:src/stl/][the standard library directory]].
*** [[file:src/bin/][binary directory]]
This contains any executable target of this project. Notably [[file:src/bin/relish.rs][the main shell]].
This contains any executable target of this project. Notably [[file:src/bin/flesh.rs][the main shell]].
* Current Status / TODO list
Note: this section will not show the status of each item unless you are viewing it with a proper orgmode viewer.
Note: this section only tracks the state of incomplete TODO items. Having everything on here would be cluttered.
@ -161,18 +162,20 @@ Note: this section only tracks the state of incomplete TODO items. Having everyt
** DONE Beta tasks
(See tag: v0.3.0)
** TODO v1.0 tasks
- Can pass args to relish scripts (via command line)
- Can pass args to relish scripts (via interpreter)
- finish basic goals in the [[file:snippets/interactive-devel.rls][interactive development library]]
- Can pass args to flesh scripts (via command line)
- Can pass args to flesh scripts (via interpreter)
- Pipe also operates on stderr
- ~ if possible (string replacement?
- tab completion for symbols also attempts to complete binaries
- tab completion for symbols also attempts to complete paths
- finish basic goals in the [[file:snippets/interactive-devel.f][interactive development library]]
- Release CI
- Rename to Flesh
- Make an icon if you feel like it
- Post release to relevant channels
** TODO v1.1 tasks
- emacs lsp implementation
- finish stretch goals in the [[file:snippets/interactive-devel.rls][interactive development library]]
- finish stretch goals in the [[file:snippets/interactive-devel.f][interactive development library]]
- History length configurable (env var?)
- Lex function
- execute configurable function on cd
- Post to relevant channels
- Implement Compose for lambdas

View file

@ -1,10 +1,10 @@
#+Title: Relish as a Shell
#+Author: Ava Hahn
#+Title: Flesh as a Shell
#+Author: Ava Affine
Note: this document is best read using a dedicated ORG mode editor
* Description
This document outlines the ways that Relish can be used as a shell for daily administration or scripting purposes. Readers should have already read through the [[file:Readme.org][general Relish documentation]]. With the exception of the ~circuit~ function, all facilities introduced in this document apply only to relish interpreters compiled with the [[file:/src/stl/posix.rs][POSIX module]] enabled and ~CFG_RELISH_POSIX~ set at load time.
This document outlines the ways that Flesh can be used as a shell for daily administration or scripting purposes. Readers should have already read through the [[file:Readme.org][general Flesh documentation]]. With the exception of the ~circuit~ function, all facilities introduced in this document apply only to flesh interpreters compiled with the [[file:/src/stl/posix.rs][POSIX module]] enabled and ~CFG_FLESH_POSIX~ set at load time.
** Launch a command
For the most common uses (executing shell commands) a function is provided to find and load binaries from entries in the ~PATH~ variable. This function may be called either with ~load~ or ~l~.
@ -39,10 +39,10 @@ Shell command evaluation rules apply to the following functions:
With the exception of the ~load-to-string~ function and the ~bg~ function, each of the aforementioned functions returns the exit code of a new process as an integer.
Symbols set in the Relish REPL are converted to strings and placed in the environment as well, so ~def~ can be used to define environment variables for a process (but not ~let~, which only creates form-local symbols).
Symbols set in the Flesh REPL are converted to strings and placed in the environment as well, so ~def~ can be used to define environment variables for a process (but not ~let~, which only creates form-local symbols).
** Special command forms
A number of forms are provided to offer a first class experience when running Relish as a shell.
A number of forms are provided to offer a first class experience when running Flesh as a shell.
*** Command short circuiting
In a shell such as Bash or Zsh, commands can be chained with the ~&&~ operator:
@ -50,7 +50,7 @@ In a shell such as Bash or Zsh, commands can be chained with the ~&&~ operator:
$ apt update && apt upgrade && echo "Success!"
#+END_EXAMPLE
In these chains, if one command fails the next one(s) are not run. Colloquially, the command short-circuits. A similar construct is offered in Relish called ~circuit~. Circuit will evaluate one or more forms (all expected to evaluate to either an integer (shell command) or a boolean (more general form). If a form returns false (or non-zero) no other forms are evaluated. The printed error message will identify where in the sequence evaluation was halted.
In these chains, if one command fails the next one(s) are not run. Colloquially, the command short-circuits. A similar construct is offered in Flesh called ~circuit~. Circuit will evaluate one or more forms (all expected to evaluate to either an integer (shell command) or a boolean (more general form). If a form returns false (or non-zero) no other forms are evaluated. The printed error message will identify where in the sequence evaluation was halted.
#+BEGIN_EXAMPLE lisp
(circuit
(l apt update) ;; if this fails, no upgrade is made
@ -59,16 +59,16 @@ In these chains, if one command fails the next one(s) are not run. Colloquially,
#+END_EXAMPLE
*** Command piping
In a shell such as Bash or Zsh, the output of one command may be automatically looped into the input of another command. Below is an example of three shell commands piped together. On execution this example counts the number of running Relish processes:
In a shell such as Bash or Zsh, the output of one command may be automatically looped into the input of another command. Below is an example of three shell commands piped together. On execution this example counts the number of running Flesh processes:
#+BEGIN_EXAMPLE shell
$ ps aux | grep relish | wc -l
$ ps aux | grep flesh | wc -l
#+END_EXAMPLE
In order to provide such a facility in Relish, the ~pipe~ function is provided.
In order to provide such a facility in Flesh, the ~pipe~ function is provided.
#+BEGIN_EXAMPLE lisp
(pipe
(ps aux)
(grep relish)
(grep flesh)
(wc -l))
#+END_EXAMPLE
@ -98,7 +98,7 @@ There will be many times a user will want to directly process command output oth
(git-status)
#+END_EXAMPLE
(Example is from [[file:snippets/avas-laptop-prompt.rls][Ava's Laptop Prompt]])
(Example is from [[file:snippets/avas-laptop-prompt.f][Ava's Laptop Prompt]])
*** Redirecting command output to or from files
Another common shell feature is the redirection of input/output to/from files. For example:
@ -106,7 +106,7 @@ Another common shell feature is the redirection of input/output to/from files. F
$ find / -iname "needle.haystack" 2> /dev/null
#+END_EXAMPLE
Relish can redirect "stdin", "stdout", or "stderr" of a shell command using the ~load-with~ function.
Flesh can redirect "stdin", "stdout", or "stderr" of a shell command using the ~load-with~ function.
#+BEGIN_EXAMPLE lisp
(load-with (("stderr" "/dev/null"))
(find / -iname "needle.haystack"))
@ -121,7 +121,7 @@ Or, a more comprehensive example using hypothetical commands and data:
#+END_EXAMPLE
** Control background and foreground processes
Relish implements fully interactive job control.
Flesh implements fully interactive job control.
To launch a background process use the ~bg~ function:
#+BEGIN_EXAMPLE lisp
(bg emacs -nw)
@ -138,13 +138,13 @@ To foreground a background process use the ~fg~ function:
#+END_EXAMPLE
** Changing directories
Relish also provides a ~cd~ utility to change current working directory:
Flesh also provides a ~cd~ utility to change current working directory:
#+BEGIN_EXAMPLE lisp
(cd (concat HOME '/repositories')) ;; $ cd ~/repositories
#+END_EXAMPLE
** Creating bindings for shell commands
Daily Relish users will long for first class shell commands that are accounted for in autocomplete.
Daily Flesh users will long for first class shell commands that are accounted for in autocomplete.
A simple solution:
#+BEGIN_EXAMPLE lisp
@ -154,7 +154,7 @@ A simple solution:
(lis HOME)
#+END_EXAMPLE
The reader may also wish for a utility that allows them to create first-class shortcuts to shell subcommands. It is for this purpose that [[file:snippets/genbind.rls][genbind]] was written. Genbind allows the user to create globally defined functions that reference shell commands (more specifically, subcommands) from their shell. The reader is advised to refer to the documentation in Genbind for more information.
The reader may also wish for a utility that allows them to create first-class shortcuts to shell subcommands. It is for this purpose that [[file:snippets/genbind.f][genbind]] was written. Genbind allows the user to create globally defined functions that reference shell commands (more specifically, subcommands) from their shell. The reader is advised to refer to the documentation in Genbind for more information.
#+BEGIN_EXAMPLE lisp
(def g-add 'shortcut for git add'
(gen-binding "git" "add"))
@ -189,7 +189,7 @@ With the ~implicit load~ feature any call to an undefined function will trigger
...... (redacted directory list) .....
#+END_EXAMPLE
Implicit load can be used by building relish with the following command:
Implicit load can be used by building flesh with the following command:
#+BEGIN_EXAMPLE
cargo build -F implicit-load

View file

@ -1,27 +1,28 @@
#+Title: Relish as a Language
#+Author: Ava Hahn
#+Title: Flesh as a Language
#+Author: Ava Affine
Note: this document is best read using a dedicated ORG mode editor
* Description
This document offers a guide on how to write beginner or intermediate scripts using the Relish language.
Readers should be able to run the Relish repl to follow along with this guide and experiment with the included examples in the REPL.
This document offers a guide on how to write beginner or intermediate scripts using the Flesh language.
Readers should be able to run the Flesh repl to follow along with this guide and experiment with the included examples in the REPL.
* Syntax
** Data types
Relish leverages the following data types:
Flesh leverages the following data types:
- Strings: delimited by one of the following: ~' " `~
- Integers: up to 128 bit signed integers
- Floats: all floats are stored as 64 bit floats
- Booleans: ~true~ or ~false~
- Symbols: an un-delimited chunk of text containing alphanumerics or one of the following: ~- _ ?~
Symbols and Functions can contain data of any type. there is no immediate restriction on what can be set/passed to what..... However, internally Relish is typed, and many builtin functions will get picky about what types are passed to them.
Symbols and Functions can contain data of any type. there is no immediate restriction on what can be set/passed to what..... However, internally Flesh is typed, and many builtin functions will get picky about what data is passed to them.
** S-Expressions
Relish, like other LISPs, is *HOMOICONIC* which means that user written code entered at the REPL is data, and that there is a direct correlation between the code as written and the program as stored in memory.
Flesh, like other LISPs, is *HOMOICONIC* which means that user written code entered at the REPL is data, and that there is a direct correlation between the code as written and the program as stored in memory.
This is achieved through *S-EXPRESSIONS*. An S-Expression (or symbolic expression) is simply a list of elements surrounded by parenthesis. Within this list are elements of any data, and potentially nested s-expressions (sometimes referred to as sexprs). Each s-expression represents one statement, or line of code to be evaluated. To evaluate an s-expression also requires that any nested s-expressions are first evaluated.
Programs in Relish (and most other lisps) are written with S-Expressions, and are then represented in memory as linked lists of heterogenous data. In memory, a linked list may contain addresses to other linked lists.
Programs in Flesh (and most other lisps) are written with S-Expressions, and are then represented in memory as linked lists of heterogenous data. In memory, a linked list may contain addresses to other linked lists.
An example:
#+BEGIN_EXAMPLE lisp
@ -45,7 +46,7 @@ In order to evaluate the code stored at ADDR 1, first ADDR 2 and ADDR 3 must be
In evaluation, a list is digested and its simplest possible form is returned. A list may represent a function call, for which the result is the simplest possible form. The list may contain variables, for which evaluation must replace with the defined values of those variables. The top level list must wait as the deepest nested lists are evaluated and their simplest possible forms return upwards to then be evaluated as members of the top level s-expression.
In this document, and in the Relish interpreter, s-expressions may be referred to as 'forms'.
In this document, and in the Flesh interpreter, s-expressions may be referred to as 'forms'.
** Calling a function
S-Expressions can represent function calls in addition to trees of data. A function call is a list of data starting with a symbol that is defined to be a function:
@ -62,7 +63,7 @@ In this example, ~(add 5 2)~ is evaluated first, its result is then passed to ~(
** Control flow
*** If
An *if form* is the most basic form of conditional evaluation offered by Relish.
An *if form* is the most basic form of conditional evaluation offered by Flesh.
It is a function that takes lazily evaluated arguments: a condition, a then clause, and an else clause.
If the condition evaluates to true, the then clause is evaluated and the result returned. Otherwise the else clause is evaluated and the result is returned. If the condition evaluates to neither true nor false, (a non-boolean value), a type error is returned.
@ -93,7 +94,7 @@ Like the *if form*, if the conditional returns a non-boolean value the *while lo
#+END_SRC
*** Let
*Let* is one of the most powerful forms Relish offers.
*Let* is one of the most powerful forms Flesh offers.
The first body in a call to let is a list of lists. Specifically, a list of variable declarations that look like this: ~(name value)~. Each successive variable definition can build off of the last one, like this: ~((step1 "hello") (step2 (concat step1 " ")) (step3 (concat step2 "world")))~. The resulting value of step3 is "hello world".
@ -121,7 +122,7 @@ If all forms evaluate to ~true~, ~true~ is returned.
Example:
#+BEGIN_SRC lisp
(circuit
(load my-shell-command) ;; exit 0 casted to true, also: requires CFG_RELISH_POSIX
(load my-shell-command) ;; exit 0 casted to true, also: requires CFG_FLESH_POSIX
(get-state-flag global-state)
(eq? (some-big-calculation) expected-result))
#+END_SRC
@ -178,7 +179,7 @@ CURRENT VALUE AND/OR BODY:
#+END_SRC
*** Quote and Eval
As stated previously: Lisp, and consequently Relish, is homoiconic. This means that code can be passed around (and modified) as data.
As stated previously: Lisp, and consequently Flesh, is homoiconic. This means that code can be passed around (and modified) as data.
This allows us to write self programming programs, or construct entire procedures on the fly. The primary means to do so are with *quote* and *eval*.
The *quote* function allows data (code) to be passed around without evaluating it. It is used to pass unevaluated code around as data that can then be evaluated later.
To be specific, typing ~(a)~ usually results in a symbol lookup for ~a~, and then possibly even a function call. However, if we *quote* ~a~, we can pass around the symbol itself:
@ -240,7 +241,7 @@ Here is the lambda bound to a variable inside a let statement:
#+END_SRC
* Defining variables and functions
In Relish, both variables and functions are stored in a table of symbols.
In Flesh, both variables and functions are stored in a table of symbols.
All Symbols defined with ~def~ are *GLOBAL*. The only cases when symbols are local is when they are defined as part of *let* forms or as arguments to functions.
In order to define a symbol, the following inputs are required:
- A name
@ -279,7 +280,7 @@ Removing a symbol consists of a call to ~def~ with no additional arguments:
#+END_SRC
* Builtin functions
The following table is up to date as of Relish 0.3.0. For latest information try the following:
The following table is up to date as of Flesh 0.4.0. For latest information try the following:
- Call ~env~ from a fresh shell: ~(env)~
This will output all variables and functions defined
- Read the [[file:src/stl.rs][std library declaration code]]
@ -322,7 +323,7 @@ Perusing them may yield answers on all the cases a given builtin can handle.
[[file:tests][The test directory]]
** Help function
Relish is self documenting. The *help* function can be used to inspect any variable or function.
Flesh is self documenting. The *help* function can be used to inspect any variable or function.
It will show the name, current value, docstring, arguments, and definition of any builtin or user defined function or variable.
#+BEGIN_EXAMPLE
> (help my-adder)
@ -339,8 +340,8 @@ args: x y
form: ((add x y))
#+END_EXAMPLE
#+BEGIN_EXAMPLE
> (help CFG_RELISH_ENV)
NAME: CFG_RELISH_ENV
> (help CFG_FLESH_ENV)
NAME: CFG_FLESH_ENV
ARGS: (its a variable)
@ -352,18 +353,18 @@ CURRENT VALUE AND/OR BODY:
true
#+END_EXAMPLE
Every single symbol in Relish can be inspected in this way, unless some third party developer purposefully left a docstring blank.
Every single symbol in Flesh can be inspected in this way, unless some third party developer purposefully left a docstring blank.
* Snippets directory
The *snippets directory* may also yield some interesting examples.
Within it are several examples that the authors and maintainers wanted to keep around but didnt know where.
It is sort of like a lint roller.
It also contains considerably subpar implementations of Relish's internals that are kept around for historical reasons.
It also contains considerably subpar implementations of Flesh's internals that are kept around for historical reasons.
** Userlib
The *Userlib* was added as a script containing many valuable functions such as ~set~ and ~prepend~.
You can use it by calling it in your shell config
(See [[file:snippets/basic_minimal_configuration.rls][The minimal shell configuration example]] for more info).
(See [[file:snippets/basic_minimal_configuration.f][The minimal shell configuration example]] for more info).
* Common patterns
This section contains common composites of control flow that may be used to build more complex or effective applications. More ideas may be explored in the [[file:snippets][snippets]] directory of this project.

View file

@ -1,7 +1,7 @@
#!/bin/relish
#!/bin/flesh
;; relish: versatile lisp shell
;; Copyright (C) 2021 Aidan Hahn
;; Flesh: Flexible Shell
;; Copyright (C) 2021 Ava Affine
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
;; AVA'S LAPTOP PROMPT
;; This file contains a shell prompt configuration that outputs current dir
;; username, and percentages for all batteries on the system.
;; -> requires CFG_RELISH_POSIX=true and userlib.
;; -> requires CFG_FLESH_POSIX=true and userlib.
(def _batteries 'paths to batteries powering system'
(lambda ()
@ -53,7 +53,7 @@
(set (q bat-iter) (pop rem))))
display)))
(def CFG_RELISH_R_PROMPT 'display battery info'
(def CFG_FLESH_R_PROMPT 'display battery info'
()
(display-batteries))
@ -92,7 +92,7 @@
")")
''))
(def CFG_RELISH_L_PROMPT 'display user and dir (git info in future)'
(def CFG_FLESH_L_PROMPT 'display user and dir (git info in future)'
()
(concat
"[" USER "]" "\t"

View file

@ -0,0 +1,12 @@
;; comment out to load USERLIB
;; (call (concat HOME "/.flesh/userlib.f"))
;; if you have userlib
;; (set CFG_FLESH_POSIX "1")
;; else
(def CFG_FLESH_POSIX
(get-doc (q CFG_FLESH_POSIX))
"1")
(echo "Welcome back to Flesh.")
(echo "Enjoy your computing.")

View file

@ -1,12 +0,0 @@
;; comment out to load USERLIB
;; (call (concat HOME "/.relish/userlib.rls"))
;; if you have userlib
;; (set CFG_RELISH_POSIX "1")
;; else
(def CFG_RELISH_POSIX
(get-doc (q CFG_RELISH_POSIX))
"1")
(echo "Welcome back to relish.")
(echo "Enjoy your computing.")

View file

@ -1,7 +1,7 @@
#!/bin/relish
#!/bin/flesh
;; relish: versatile lisp shell
;; Copyright (C) 2021 Aidan Hahn
;; Flesh: Flexible Shell
;; Copyright (C) 2021 Ava Affine
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
#!/bin/relish
#!/bin/flesh
;; relish: versatile lisp shell
;; Copyright (C) 2021 Aidan Hahn
;; Flesh: Flexible Shell
;; Copyright (C) 2021 Ava Affine
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: highly versatile lisp interpreter
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: highly versatile lisp interpreter
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

15
snippets/mood-prompt.f Normal file
View file

@ -0,0 +1,15 @@
#!/bin/flesh
(def __mood 'current mood' ':3')
(def CFG_FLESH_L_PROMPT 'mood left prompt'
() (concat "(" __mood ")" ))
(def CFG_FLESH_R_PROMPT 'mood right prompt'
() 'call set-mood to change prompt')
(def CFG_FLESH_PROMPT_DELIMITER 'mood prompt delim'
() '>')
(def set-mood 'set the little ascii face in your prompt'
(mood) (set (q __mood) mood))

View file

@ -1,15 +0,0 @@
#!/bin/relish
(def __mood 'current mood' ':3')
(def CFG_RELISH_L_PROMPT 'mood left prompt'
() (concat "(" __mood ")" ))
(def CFG_RELISH_R_PROMPT 'mood right prompt'
() 'call set-mood to change prompt')
(def CFG_RELISH_PROMPT_DELIMITER 'mood prompt delim'
() '>')
(def set-mood 'set the little ascii face in your prompt'
(mood) (set (q __mood) mood))

View file

@ -1,4 +1,4 @@
#!/bin/relish
#!/bin/flesh
(def prepend
'takes a list and appends an element to the back of it.

View file

@ -1,7 +1,7 @@
;;; relish-mode.el --- sample major mode for editing Relish. -*- coding: utf-8; lexical-binding: t; -*-
;;; flesh-mode.el --- Flesh -*- coding: utf-8; lexical-binding: t; -*-
;; Copyright © 2017, by Ava Hahn
;; Author: Ava Hahn (ava@sunnypup.io)
;; Copyright © 2023, by Ava Affine
;; Author: Ava Affine (ava@sunnypup.io)
;; Version: 1
;; Keywords: languages
@ -12,7 +12,7 @@
;;; Code:
(setq relish-keywords
(setq flesh-keywords
(let* (
(r-control-flow '("if" "let" "circuit" "while" "assert" "exit"))
(r-declaration '("lambda" "q" "quote" "def" "get-doc" "set-doc" "set?"))
@ -53,7 +53,7 @@
(,r-userlib-regexp . 'font-lock-function-name-face)
)))
(setq relish-mode-syntax-table
(setq flesh-mode-syntax-table
(let ((table (make-syntax-table)))
;; string delims
(modify-syntax-entry ?' "\"" table)
@ -68,12 +68,12 @@
(define-derived-mode relish-mode
text-mode
"Major mode for editing Relish"
:syntax-table relish-mode-syntax-table
(setq font-lock-defaults '((relish-keywords))))
"Flesh"
:syntax-table flesh-mode-syntax-table
(setq font-lock-defaults '((flesh-keywords))))
(add-to-list 'auto-mode-alist '("\\.rls\\'" . relish-mode))
(add-to-list 'auto-mode-alist '(".relishrc" . relish-mode))
(add-to-list 'auto-mode-alist '("\\.f\\'" . relish-mode))
(add-to-list 'auto-mode-alist '(".fleshrc" . relish-mode))
(provide 'relish-mode)
;;; relish-mode.el ends here
;;; flesh-mode.el ends here

View file

@ -1,7 +1,7 @@
#!/bin/relish
#!/bin/flesh
;; relish: versatile lisp shell
;; Copyright (C) 2021 Aidan Hahn
;; Flesh: Flexible Shell
;; Copyright (C) 2021 Ava Affine
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
#!/bin/relish
#!/bin/flesh
;; relish: versatile lisp shell
;; Copyright (C) 2021 Aidan Hahn
;; Flesh: Flexible Shell
;; Copyright (C) 2021 Ava Affine
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@ -53,7 +53,7 @@
refactor your program: put iterators, counters, procedurally generated code,
and all other mutable state into a let loop.
A cozy script in relish is one where each root level form (or eval at repl)
A cozy script in flesh is one where each root level form (or eval at repl)
is self contained, and does not permanently modify any other one.
See the userlib tests for an easy to follow example of this.'

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
*/
use {
relish::{
flesh::{
ast::{
eval, lex, run,
Ctr, Seg, SymTable, Symbol,
@ -51,7 +51,7 @@ use {
};
#[cfg(feature="posix")]
use relish::aux::{ShellState, check_jobs};
use flesh::aux::{ShellState, check_jobs};
#[cfg(feature="posix")]
use nix::unistd;
@ -279,14 +279,14 @@ fn add_menu_keybindings(keybindings: &mut Keybindings) {
}
fn main() {
const HIST_FILE: &str = "/.relish_hist";
const CONFIG_FILE_DEFAULT: &str = "/.relishrc";
const HIST_FILE: &str = "/.flesh_hist";
const CONFIG_FILE_DEFAULT: &str = "/.fleshrc";
const VERSION: &str = env!("CARGO_PKG_VERSION");
if env::args().count() > 1 &&
env::args()
.collect::<Vec<_>>()
.contains(&"--version".to_string()) {
println!("Relish {}", VERSION);
println!("Flesh {}", VERSION);
return;
}
@ -501,7 +501,7 @@ fn get_token_to_complete(line: &str, pos: usize) -> (String, bool, usize) {
* closure as a signal handler. As of May 2023 there is no clear
* way of doing such a thing.
*
* Luckily this data is only used within Relish, so we can simply
* Luckily this data is only used within Flesh, so we can simply
* rely on it only being read during the evaluation phase of the REPL.
* This method will at least work for that. (ava)
*/

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: highly versatile lisp interpreter
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: highly versatile lisp interpreter
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -45,8 +45,8 @@ pub mod stdlib {
R_PROMPT_VNAME,
PROMPT_DELIM_VNAME,
CFG_FILE_VNAME,
RELISH_DEFAULT_CONS_HEIGHT,
RELISH_DEFAULT_CONS_WIDTH,
FLESH_DEFAULT_CONS_HEIGHT,
FLESH_DEFAULT_CONS_WIDTH,
};
}

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -67,7 +67,7 @@ Attempts to find argument in PATH and attempts to call argument";
pub fn run_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
if let Ctr::String(ref filename) = *ast.car {
if filename.ends_with(".rls") {
if filename.ends_with(".f") {
if let Some(filepath) = find_on_path(filename.to_string()) {
run(filepath, syms)
.and(Ok(Ctr::None))
@ -91,7 +91,7 @@ pub fn run_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
}
} else {
Err(start_trace(
("<call script>", "expected a relish script with a .rls extension")
("<call script>", "expected a flesh script with a .f extension")
.into()))
}
} else {

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,16 +34,16 @@ pub mod math;
pub mod strings;
pub mod file;
pub const CONSOLE_XDIM_VNAME: &str = "_RELISH_WIDTH";
pub const CONSOLE_YDIM_VNAME: &str = "_RELISH_HEIGHT";
pub const POSIX_CFG_VNAME: &str = "CFG_RELISH_POSIX";
pub const MODENV_CFG_VNAME: &str = "CFG_RELISH_ENV";
pub const L_PROMPT_VNAME: &str = "CFG_RELISH_L_PROMPT";
pub const R_PROMPT_VNAME: &str = "CFG_RELISH_R_PROMPT";
pub const PROMPT_DELIM_VNAME: &str = "CFG_RELISH_PROMPT_DELIMITER";
pub const CFG_FILE_VNAME: &str = "RELISH_CFG_FILE";
pub const RELISH_DEFAULT_CONS_HEIGHT: i16 = 24;
pub const RELISH_DEFAULT_CONS_WIDTH: i16 = 80;
pub const CONSOLE_XDIM_VNAME: &str = "_FLESH_WIDTH";
pub const CONSOLE_YDIM_VNAME: &str = "_FLESH_HEIGHT";
pub const POSIX_CFG_VNAME: &str = "CFG_FLESH_POSIX";
pub const MODENV_CFG_VNAME: &str = "CFG_FLESH_ENV";
pub const L_PROMPT_VNAME: &str = "CFG_FLESH_L_PROMPT";
pub const R_PROMPT_VNAME: &str = "CFG_FLESH_R_PROMPT";
pub const PROMPT_DELIM_VNAME: &str = "CFG_FLESH_PROMPT_DELIMITER";
pub const CFG_FILE_VNAME: &str = "FLESH_CFG_FILE";
pub const FLESH_DEFAULT_CONS_HEIGHT: i16 = 24;
pub const FLESH_DEFAULT_CONS_WIDTH: i16 = 80;
fn l_prompt_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, Traceback> {
Ok(Ctr::String(">".to_string()))
@ -87,7 +87,7 @@ pub fn static_stdlib(syms: &mut SymTable) {
/// callbacks with configuration into a symtable
#[cfg(feature="posix")]
pub fn dynamic_stdlib(syms: &mut SymTable, shell: Option<Rc<RefCell<posix::ShellState>>>) {
// get CFG_RELISH_ENV from syms
// get CFG_FLESH_ENV from syms
let env_cfg_user_form = syms
.call_symbol(&MODENV_CFG_VNAME.to_string(), &Seg::new(), true)
.unwrap_or_else(|_: Traceback| Box::new(Ctr::None))
@ -207,7 +207,7 @@ default value: 1 (set)
&String::from(CONSOLE_XDIM_VNAME),
&String::from("Length of current console"),
&Seg::from_mono(Box::new(
Ctr::Integer(RELISH_DEFAULT_CONS_WIDTH.into())
Ctr::Integer(FLESH_DEFAULT_CONS_WIDTH.into())
)),
None,
)
@ -219,7 +219,7 @@ default value: 1 (set)
&String::from(CONSOLE_YDIM_VNAME),
&String::from("Height of current console"),
&Seg::from_mono(Box::new(
Ctr::Integer(RELISH_DEFAULT_CONS_HEIGHT.into())
Ctr::Integer(FLESH_DEFAULT_CONS_HEIGHT.into())
)),
None,
)

View file

@ -1,4 +1,5 @@
/* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,4 +1,5 @@
/* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Hahn
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
use crate::eval::eval;
use crate::error::{Traceback, start_trace};
use crate::segment::{Ctr, Seg, Type};
use crate::stdlib::{CONSOLE_XDIM_VNAME, RELISH_DEFAULT_CONS_WIDTH};
use crate::stdlib::{CONSOLE_XDIM_VNAME, FLESH_DEFAULT_CONS_WIDTH};
use crate::sym::{SymTable, Symbol, UserFn, ValueType, Args};
use std::env;
use std::rc::Rc;
@ -140,8 +140,8 @@ fn env_callback(_ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
xdim = dim;
} else {
println!("{} contains non integer value, defaulting to {}",
CONSOLE_XDIM_VNAME, RELISH_DEFAULT_CONS_WIDTH);
xdim = RELISH_DEFAULT_CONS_WIDTH as i128;
CONSOLE_XDIM_VNAME, FLESH_DEFAULT_CONS_WIDTH);
xdim = FLESH_DEFAULT_CONS_WIDTH as i128;
}
let mut v_col_len = 0;

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Hahn
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,4 +1,5 @@
/* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* relish: versatile lisp shell
* Copyright (C) 2021 Aidan Hahn
/* Flesh: Flexible Shell
* Copyright (C) 2021 Ava Affine
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
mod eval_tests {
use relish::ast::{eval, lex, SymTable};
use relish::ast::{Args, Ctr, Seg, Symbol, UserFn, ValueType};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, SymTable};
use flesh::ast::{Args, Ctr, Seg, Symbol, UserFn, ValueType};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn eval_simple() {

View file

@ -1,7 +1,7 @@
mod func_tests {
use relish::ast::lex;
use relish::ast::{Args, Ctr, Seg, Symbol, ValueType, Traceback};
use relish::ast::{SymTable, Type, UserFn, start_trace};
use flesh::ast::lex;
use flesh::ast::{Args, Ctr, Seg, Symbol, ValueType, Traceback};
use flesh::ast::{SymTable, Type, UserFn, start_trace};
use std::rc::Rc;
#[test]

View file

@ -1,5 +1,5 @@
mod lex_tests {
use relish::ast::lex;
use flesh::ast::lex;
#[test]
fn test_lex_basic_pair() {
@ -60,7 +60,7 @@ mod lex_tests {
#[test]
fn test_comment_1() {
let document = String::from("#!/bin/relish\n(one two)");
let document = String::from("#!/bin/flesh\n(one two)");
let output: &str = "(one two)";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
}
@ -75,7 +75,7 @@ mod lex_tests {
#[test]
fn test_postline_comment_1() {
let document =
String::from("#!/bin/relish\n((one two)# another doc comment\n('three' four))");
String::from("#!/bin/flesh\n((one two)# another doc comment\n('three' four))");
let output: &str = "((one two) ('three' four))";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
}
@ -83,14 +83,14 @@ mod lex_tests {
#[test]
fn test_postline_comment_2() {
let document =
String::from("#!/bin/relish\n((one two);;another doc comment\n(three four))");
String::from("#!/bin/flesh\n((one two);;another doc comment\n(three four))");
let output: &str = "((one two) (three four))";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
}
#[test]
fn test_inline_comment_1() {
let document = String::from("#!/bin/relish\n((one two)\n# another comment\nthree)");
let document = String::from("#!/flesh/flesh\n((one two)\n# another comment\nthree)");
let output: &str = "((one two) three)";
assert_eq!(lex(&document).unwrap().to_string(), output.to_string(),);
}

View file

@ -1,6 +1,6 @@
mod append_lib_tests {
use relish::ast::{eval, lex, SymTable};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, SymTable};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_cons_to_empty_list() {

View file

@ -1,6 +1,6 @@
mod bool_lib_tests {
use relish::ast::{eval, lex, Ctr, SymTable};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, Ctr, SymTable};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_and_true_chain() {

View file

@ -1,6 +1,6 @@
mod control_lib_tests {
use relish::ast::{eval, lex, SymTable};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, SymTable};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_assert_t() {

View file

@ -1,6 +1,6 @@
mod decl_lib_tests {
use relish::ast::{eval, lex, Ctr, SymTable};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, Ctr, SymTable};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_variable_def_and_lookup() {

View file

@ -1,6 +1,6 @@
mod file_lib_tests {
use relish::ast::{eval, lex, SymTable};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, SymTable};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_fexists() {
@ -38,7 +38,7 @@ mod file_lib_tests {
fn test_write_file() {
let document = "
(let ((s 'test')
(t '/tmp/relish-lib-test-file-1'))
(t '/tmp/flesh-lib-test-file-1'))
(write-file t s)
(echo (read-file t))
(eq? (read-file t) s))";
@ -59,7 +59,7 @@ mod file_lib_tests {
fn test_append_file() {
let document = "
(let ((s 'test')
(t '/tmp/relish-lib-test-file-2'))
(t '/tmp/flesh-lib-test-file-2'))
(write-file t s)
(append-file t s)
(eq? (read-file t)

View file

@ -1,6 +1,6 @@
mod math_lib_tests {
use relish::ast::{eval, lex, Ctr, SymTable};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, Ctr, SymTable};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_add_chain() {

View file

@ -1,7 +1,7 @@
mod posix_tests {
use relish::aux::args_from_ast;
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use relish::ast::{lex, eval, SymTable};
use flesh::aux::args_from_ast;
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{lex, eval, SymTable};
#[test]
fn test_cmd_singlet() {

View file

@ -1,6 +1,6 @@
mod str_lib_tests {
use relish::ast::{eval, lex, SymTable};
use relish::stdlib::{dynamic_stdlib, static_stdlib};
use flesh::ast::{eval, lex, SymTable};
use flesh::stdlib::{dynamic_stdlib, static_stdlib};
#[test]
fn test_simple_concat() {