|
|
1.1 ! root 1: # ! 2: # C F L R E C O G N I T I O N ! 3: # ! 4: ! 5: # This program takes strings from standard input and determines ! 6: # whether or not they are sentences in the language defined by <s>. ! 7: ! 8: procedure main() ! 9: local line ! 10: while line := read() do ! 11: if recogn(s,line) then write("accepted") else write("rejected") ! 12: end ! 13: ! 14: procedure recogn(goal,text) ! 15: return text ? (goal() & pos(0)) ! 16: end ! 17: ! 18: # <s> ::= a <s> | <t> b | c ! 19: ! 20: procedure s() ! 21: suspend (="a" || s()) | (t() || ="b") | ="c" ! 22: end ! 23: ! 24: # <t> ::= d <s> d | e | f ! 25: ! 26: procedure t() ! 27: suspend (="d" || s() || ="d") | ="e" | ="f" ! 28: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.