module Lilis: sig
.. end
Library to Interpret Lindenmayer Systems.
L-system representation
A L-system is described by a name, an axiom and a bunch of rules. Each symbols can have some arithmetic expressions as arguments.
type 'a
stream = ('a * float list) list
A simple L-system axiom. An axiom is a list of symbols.
type 'a
rule = {
|
lhs : string ; |
|
vars : string list ; |
|
rhs : 'a list ; |
}
A L-system rule. A rule is composed of a left-hand side with a single symbol, potentially some variables and a right-hand side which is a list of symbols where arithmetic expressions can contains those variables. The right hand side can be composed of non-string tokens.
type 'a
lsystem = {
|
name : string ; |
|
axiom : (string * string Calc.t list) list ; |
|
rules : (string * string Calc.t list) rule list ; |
|
post_rules : 'a rule list ; |
}
A complete L-system. 'a
is the output type of the L-system. For example, we can have a set of rules that will transform tokens to graphical orders.
Functorized Engine
module SymbEnv: sig
.. end
The symbolic environment is the dictionary to compress and decompress streams.
module type S = sig
.. end
A stream-like data structure should be lazy and support O(1) concatenation.
module Make (
Lstream
:
S
)
: sig
.. end
A functor to build your own little L-system engine given a stream-like data structure.