Tiny expressions-based language for elementary cellular automata simulation

add readme and langrefs

+140
+41
README.md
··· 1 + # ecaxpr 2 + 3 + Tiny expressions-based language for elementary cellular automata simulation. 4 + 5 + --- 6 + 7 + 8 + ``` 9 + l == ~(r | t) 10 + 11 + ***************#*************** 16 12 + ``` 13 + 14 + becomes... 15 + 16 + ``` 17 + ***************#*************** 18 + **************###************** 19 + *************##**#************* 20 + ************##*####************ 21 + ***********##**#***#*********** 22 + **********##*####*###********** 23 + *********##**#****#**#********* 24 + ********##*####**######******** 25 + *******##**#***###*****#******* 26 + ******##*####*##**#***###****** 27 + *****##**#****#*####*##**#***** 28 + ****##*####**##*#****#*####**** 29 + ***##**#***###**##**##*#***#*** 30 + **##*####*##**###*###**##*###** 31 + *##**#****#*###***#**###**#**#* 32 + ##*####**##*#**#*#####**####### 33 + ``` 34 + 35 + --- 36 + 37 + - [Installation](./docs/install.md). 38 + 39 + - [Guide](./docs/guide.md). 40 + 41 + - [Language Reference](./docs/langrefs.md).
+16
docs/guide.md
··· 1 + # `ecaxpr` Guide 2 + 3 + `ecaxpr` is a domain-specific language. That domain here is elementary cellular automata. 4 + 5 + If you are unfamiliar with elementary cellular automata, and cellular automata in general, then this guide will not be able to help you. As such, you may consider resources like 6 + 7 + - [Cellular Automata (Wikipedia)](https://en.wikipedia.org/wiki/Cellular_automaton). 8 + 9 + - [Conway's Game of Life (Lifewiki)](https://conwaylife.com/wiki/Conway%27s_Game_of_Life). 10 + 11 + - [Wolfram Mathworld's entry on Elementary Cellular Automata](https://mathworld.wolfram.com/ElementaryCellularAutomaton.html). 12 + 13 + - [The "Rule 30" Wikipedia page - a particular ECA](https://en.wikipedia.org/wiki/Rule_30). 14 + 15 + This guide assumes that you have `ecaxpr` installed on your system. You may refer to the [Installation Instructions](./install.md) page if you have not already installed it. 16 +
+1
docs/install.md
··· 1 + # in the works... look back again later
+82
docs/langrefs.md
··· 1 + # Language Reference 2 + 3 + Every `ecaxpr` file corresponds to an `ecaxpr` expression. 4 + 5 + An `ecaxpr` expression consists of three parts: 6 + 7 + 1. `L-expr`: A predicate logic expression representing the rules. 8 + 9 + 2. `State-expr`: An expression representing the initial state. 10 + 11 + 3. `Steps-expr`: A non-negative integer representing the number of steps to simulate. 12 + 13 + These names are mostly neologisms given for convenience and precise reference. 14 + 15 + Each part of the `ecaxpr` expression must occur in order exactly as stated. 16 + 17 + Newlines, spaces, and tabs do not matter. 18 + 19 + ## L-expr 20 + 21 + The following is a verbal description of the grammar of `L-expr`. 22 + 23 + For any operation that is mentioned as "taking in" `L-expr`, it should be assumed that what they produce are also `L-expr`. No exceptions arise. 24 + 25 + ### Predicates 26 + 27 + > The simplest of `L-expr` are `l`, `t`, and `r`. 28 + 29 + Given any cell in our elementary cellular automaton, `l` is the value of the cell to the left, `t` the value of the present cell ("this" cell), and `r` the value of the cell to the right. 30 + 31 + These are called **predicates**, a fancy name for variables in logic. 32 + 33 + ### Negation 34 + 35 + Given any `L-expr`, we can take its negation. 36 + 37 + To take the negation of a statement or predicate in logic means to invert its truth value. If it is true, then its negation is false, and vice versa. 38 + 39 + > If an `L-expr` predicate is writen as `X`, we take its negation as `~X` in an `L-expr`. Thus, if `X` is `t`, its negation is `~t`. 40 + 41 + ### Conjunction ("AND") 42 + 43 + Given any set of at least two `L-expr`, we can take their conjunction. 44 + 45 + To take the conjunction in logic means to check if *all* the conjuncted statements or predicates are true. The conjunction statement/predicate itself is only true if all of them are true, and false otherwise. 46 + 47 + For two statements/predicates, this corresponds to stating that both of them are true. In general, it corresponds to stating that *all* of them are true. 48 + 49 + > Suppose that we have two `L-expr` predicates written as `A` and `B`, respectively. Then, their conjunction is written as `A & B`. 50 + 51 + > Suppose that we have a list of N `L-expr` predicates, where N is some non-negative integer greater than or equal to 2. Suppose that they are written as `L1`, `L2`, `L3`, ..., `LN`, respectively. Then, their conjunction is written out as `L1 & L2 & ... & LN`. 52 + 53 + ### Disjunction ("OR") 54 + 55 + Given any set of at least two `L-expr`, we can take their disjunction. 56 + 57 + To take the disjunction in logic means to check if *at least one* of the disjuncted statements or predicates is true. The disjunction statement/predicate itself is only false if all of them are false, and true otherwise. 58 + 59 + > Suppose that we have two `L-expr` predicates written as `A` and `B`, respectively. Then, their disjunction is written as `A | B`. 60 + 61 + > Suppose that we have a list of N `L-expr` predicates, where N is some positive integer greater than or equal to 2. Suppose that they are written as `L1`, `L2`, `L3`, ..., `LN`, respectively. Then, their disjunction is written out as `L1 | L2 | ... | LN`. 62 + 63 + ### Equality 64 + 65 + Given any two `L-expr`, we can take their equality. 66 + 67 + To "take the equality" here means to check if both of the operands are of the same truth values. If so, then the equality is true, and false otherwise. 68 + 69 + > Suppose that we have two `L-expr` predicates written as `A` and `B`, respectively. Then, their equality is written as `A == B`. 70 + 71 + ## State-expr 72 + 73 + A `State-expr` consists of `*` and `#` in succession. 74 + 75 + - `*` represents white or `false` cells. 76 + - `#` represents black or `true` cells. 77 + 78 + Thus, `***#***` would correspond to an initial states configuration where the first three cells are `false`, followed by a `true` one, which is then followed by three more `false` cells. 79 + 80 + ## Steps-expr 81 + 82 + A `Steps-expr` is simply a non-negative integer.