Orasund/elm-tracery/5.0.0

Tracery.Command

Commands are used to be able to pause the execution of a Grammar.

By modifying the commands in a grammar you can directly change how the program should run.

type Command
= Print Expression
| Define (Dict String Definition)
| Delete (List String)
| Save
{ asConstant : String
, replaceWith : List Command
}

Defines commands that the algorithm recognizes

  • Print - print the expression to the output
  • Define - Add a set of definitions
  • Delete - Delete a set of definitions
  • Save - saves the current value of the output as a constant and replaces it with a different value.
simplify : List Command -> List Command

simplifies the commands.

toString : (String -> String) -> List Command -> String

Turns the list of commands into a readable string

(String -> Generator (List Command))
-> List Command
-> Generator (List Command)

replaces all variables

Convert expressions to commands

variables : List Command -> List String

Returns all variables.

onlyValues : List Command -> Bool

States if only values are in the list. This essentially means, that all processing has been done.