summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-01-31 07:36:52 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2025-01-31 07:36:52 +0100
commit2ce14aec655589f00442ab469b9d877a143eeefd (patch)
tree8cd12b1869d10ef16a449a8e182a3077b86c9810 /README.md
init commit
Diffstat (limited to 'README.md')
-rw-r--r--README.md145
1 files changed, 145 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0c16cd8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,145 @@
+# Implementation of *Ēostre’s Shell*
+
+# Syntax
+## Piping
+```esh
+program_0 | program_1 | program_2 | ... | program_n
+```
+
+## Comments
+```esh
+# Comments are written like this
+```
+
+## Forcing Pipe Mode
+### Force String
+```esh
+mode(string) { program_0 | program_1 } | program_2 | program_3
+```
+### Force *EAPM*
+```esh
+unsafe {
+ mode(raw) { program_0 | program_1 } | program_2 | program_3
+}
+```
+
+Forcing `EAPM` can only happen in a unsafe block.
+All pipes in a forced mode scope will be forced to this mode.
+In this example `program_0` and `program_1` will run in the forced
+mode.
+
+## If-Statement
+```esh
+if (program arg_1 arg_2 ... arg_n) {
+ # do something here
+}
+```
+```esh
+if (program arg_1 arg_2 ... arg_n) {
+ # do something here
+} else {
+ # do something else
+}
+```
+```esh
+if (program0 arg_1 arg_2 ... arg_n) {
+ # do something here
+} else if program1 arg_1 arg_2 ... arg_n {
+ # do something here
+} else {
+ # do something else
+}
+```
+
+## For-Loop
+For loops are always *line-based*
+```esh
+for line in (program arg_1 arg_2 ... arg_n) {
+ # do something here
+}
+```
+
+## While-Loop
+```esh
+while (program arg_1 arg_2 ... arg_n) {
+ # do something here
+}
+```
+
+## Variables
+### Set
+```esh
+var = {
+ program arg_1 arg_2 ... arg_n
+}
+```
+
+### Get
+This will pass `var` as `arg_1`
+``` esh
+program arg_1 (var) arg_3 ... arg_n
+```
+
+## String
+### Normal String
+``` esh
+var = "Some random string"
+```
+
+#### Embedding other variables and program calls into string definition.
+``` esh
+var2 = "this is var: (var) and program gives the output: {program arg_1 arg_2 ... arg_n}"
+```
+If you want to use `{` or `}` as a real character use the escape character `\` or use a raw
+string:
+
+``` esh
+var = "The following is a curly bracket: \{"
+```
+
+### Raw String
+A raw string is a string where no character except the end character
+is treated special
+``` esh
+var = 'Some string where I can use " without ending the string'
+```
+
+## Functions
+``` esh
+fn my-function(arg_1 arg_2 arg_3) {
+ # do something here
+}
+```
+
+### `Use`-Keyword
+
+The `use` keyword passes a variable from the parent to the child scope.
+If the variable does not exist in the parent context yet it will
+set it to a empty string.
+
+``` esh
+fn my-function(arg_1 arg_2 arg_3) use (var0 var1) {
+ # do something here
+}
+```
+
+## Multi-Line Expressions
+``` esh
+program arg_1 \
+ arg_2 \
+ ...
+ arg_n
+```
+
+## Merging Lines
+``` esh
+program0 arg_1 arg_2 ... arg_n; program1 arg_1 arg_2 ... arg_n
+```
+
+``` esh
+program0 && program1
+```
+
+``` esh
+program0 || program1
+```