···11+# `ecaxpr` Guide
22+33+`ecaxpr` is a domain-specific language. That domain here is elementary cellular automata.
44+55+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
66+77+- [Cellular Automata (Wikipedia)](https://en.wikipedia.org/wiki/Cellular_automaton).
88+99+- [Conway's Game of Life (Lifewiki)](https://conwaylife.com/wiki/Conway%27s_Game_of_Life).
1010+1111+- [Wolfram Mathworld's entry on Elementary Cellular Automata](https://mathworld.wolfram.com/ElementaryCellularAutomaton.html).
1212+1313+- [The "Rule 30" Wikipedia page - a particular ECA](https://en.wikipedia.org/wiki/Rule_30).
1414+1515+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.
1616+
···11+# Language Reference
22+33+Every `ecaxpr` file corresponds to an `ecaxpr` expression.
44+55+An `ecaxpr` expression consists of three parts:
66+77+1. `L-expr`: A predicate logic expression representing the rules.
88+99+2. `State-expr`: An expression representing the initial state.
1010+1111+3. `Steps-expr`: A non-negative integer representing the number of steps to simulate.
1212+1313+These names are mostly neologisms given for convenience and precise reference.
1414+1515+Each part of the `ecaxpr` expression must occur in order exactly as stated.
1616+1717+Newlines, spaces, and tabs do not matter.
1818+1919+## L-expr
2020+2121+The following is a verbal description of the grammar of `L-expr`.
2222+2323+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.
2424+2525+### Predicates
2626+2727+> The simplest of `L-expr` are `l`, `t`, and `r`.
2828+2929+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.
3030+3131+These are called **predicates**, a fancy name for variables in logic.
3232+3333+### Negation
3434+3535+Given any `L-expr`, we can take its negation.
3636+3737+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.
3838+3939+> 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`.
4040+4141+### Conjunction ("AND")
4242+4343+Given any set of at least two `L-expr`, we can take their conjunction.
4444+4545+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.
4646+4747+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.
4848+4949+> Suppose that we have two `L-expr` predicates written as `A` and `B`, respectively. Then, their conjunction is written as `A & B`.
5050+5151+> 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`.
5252+5353+### Disjunction ("OR")
5454+5555+Given any set of at least two `L-expr`, we can take their disjunction.
5656+5757+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.
5858+5959+> Suppose that we have two `L-expr` predicates written as `A` and `B`, respectively. Then, their disjunction is written as `A | B`.
6060+6161+> 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`.
6262+6363+### Equality
6464+6565+Given any two `L-expr`, we can take their equality.
6666+6767+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.
6868+6969+> Suppose that we have two `L-expr` predicates written as `A` and `B`, respectively. Then, their equality is written as `A == B`.
7070+7171+## State-expr
7272+7373+A `State-expr` consists of `*` and `#` in succession.
7474+7575+- `*` represents white or `false` cells.
7676+- `#` represents black or `true` cells.
7777+7878+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.
7979+8080+## Steps-expr
8181+8282+A `Steps-expr` is simply a non-negative integer.