Brian Theado 09Oct2005 - From [L1 ] - "The Dada Engine is a system for generating random text from grammars". Here is a simple implementation of the concept using Tcl and subst. There are several example grammars included in the real dada engine distribution and one of the examples, exam.pb, has been translated to my syntax and is included below.

``` # These two functions are to be used in "grammar scripts"
proc define {name content} {
proc \$name {} [list expand \$content]
}
proc defchoice {name choices} {
proc \$name {} [list choice \$name \$choices]
}

# Helper functions
proc expand str {subst \$str}
proc choice {name choices} {
set idx [expr int(floor(rand()*[llength \$choices]))]
return [expand [lindex \$choices \$idx]]
}

# Demo "grammar script" -- translated exam.pb from the dada engine distribution -- "generates intimidating but bogus exam questions"
proc exam {} {
defchoice question {
[question-2]
[question-2]
{[question-2] Include [evidence-type].}}
defchoice question-2 {
{Compute the [something-of ] of [something].}
{Are [plural] [classification]? Discuss.}
{Is [singular] [classification]? Discuss.}
{Express [something] in [express-in-what].}
{Show that the [something-of ] of [something] is [result].}}
defchoice issue {{[theorem-source]'s Theorem} {[theory-type] theory}
"Plutonium Atom Totality" {the [ordinal] law of [law-of-this]}}
defchoice theorem-source {Godel Wibbel Abian Turing Euler Fermat Bell}
defchoice theory-type {game set match interstice information ring group graph}
defchoice law-of-this {thermodynamics "conservation of matter" gravity}
defchoice express-in-what  {"canonical form" "normal form" {the [tag] domain}}
{[tag]-[something-of-2]}}
defchoice adjective {canonical minimal maximal inverse}
defchoice something-of-2 {closure determinant matrix path correlation}
defchoice plural-2 {trees matrices}
defchoice singular-2 {search factorisation}
defchoice result {number "{ }" infinity uncomputable "the null set"}
defchoice evidence-type {flowcharts "Feynman diagrams" "Venn diagrams"}
defchoice something {[number] [set-of-numbers]}
define set-of-numbers {{ [numbers] }}
defchoice numbers {{[number][numbers]} [number]}
defchoice number {{[digit][number]} [digit]}
defchoice digit {0 1 2 3 4 5 6 7 8 9}
define classification {[tag]-complete}
defchoice tag {[greek-letter] [roman-letter] {[roman-letter] [roman-letter]}}
defchoice roman-letter {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
defchoice greek-letter {alpha beta gamma delta epsilon lambda sigma theta phi rho omega}
defchoice ordinal {first second third fourth fifth}
return [question]
}

# Run demo code
catch { console show }
puts [exam]```

# Example outputs:

• Are minimal matrices S Z-complete? Discuss. Include Venn diagrams.
• Show that the canonical determinant of 1 is infinity.
• Is minimal factorisation phi-complete? Discuss. Be sure to refer to Plutonium Atom Totality in your answer.
• Express { 8775460 } in the K I domain.

 Category Toys
{"ft_lang_label":"__label__en","ft_lang_prob":0.66189206,"math_prob":0.66074544,"size":2880,"snap":"2021-43-2021-49","text_gpt3_token_len":738,"char_repetition_ratio":0.15959667,"word_repetition_ratio":0.0051150895,"special_character_ratio":0.26354167,"punctuation_ratio":0.03908046,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99121684,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-20T06:29:37Z\",\"WARC-Record-ID\":\"<urn:uuid:d4fa3d8d-bafe-48c8-b36d-13ae2776d7fd>\",\"Content-Length\":\"9963\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b852d5d8-ed31-4bff-8b81-c0665c39cbb0>\",\"WARC-Concurrent-To\":\"<urn:uuid:d09110c9-c05c-40cc-8608-0d08c9068919>\",\"WARC-IP-Address\":\"104.18.184.65\",\"WARC-Target-URI\":\"https://wiki.tcl-lang.org/page/Dada+Engine\",\"WARC-Payload-Digest\":\"sha1:RJIWPA7BP44DDARKIN5HMKIEUFUOMXME\",\"WARC-Block-Digest\":\"sha1:UCQ3INEQUFAMIN7YVEEDYXVTERJHBQSI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585302.91_warc_CC-MAIN-20211020055136-20211020085136-00048.warc.gz\"}"}