# 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 ```