package lilis

  1. Overview
  2. Docs

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 = {
  1. lhs : string;
  2. vars : string list;
  3. 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 = {
  1. name : string;
  2. axiom : (string * string Calc.t list) list;
  3. rules : (string * string Calc.t list) rule list;
  4. 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. Can be lazy or not, functional or not.

OCaml

Innovation. Community. Security.