Skip to content

Instantly share code, notes, and snippets.

@evanlh
Created March 21, 2017 01:57
Show Gist options
  • Save evanlh/c8211a7493f0803f00b407081717e52e to your computer and use it in GitHub Desktop.
Save evanlh/c8211a7493f0803f00b407081717e52e to your computer and use it in GitHub Desktop.
yertle_ocaml.ml
(*
Spitballing...
L system = {
alphabet: set of symbols, terminals and variables,
start: initial list of symbols,
rules: set of tuples from a symbol to a list of symbols
}
*)
type symbol = Symbol of string;;
type rule = Rule of symbol * symbol list;;
type lSystem = { alphabet: symbol list; start: symbol list; rules: rule list; }
type lSysTuple = symbol list * symbol list * rule list;;
let a = Symbol "a";;
let b = Symbol "b";;
let r1 = Rule (a, [a;b]);;
let r2 = Rule (b, [b;b]);;
let lSys1 = ([a;b], [a;a;b], [r1;r2]);;
(*
type rule = { symbol: char; expansion: char list };;
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment