Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.compilers    |    Compiler construction, theory, etc. (Mod    |    2,753 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 1,300 of 2,753    |
|    Russ Cox to All    |
|    Re: Generate text, given a regex    |
|    11 Apr 08 16:59:01    |
      From: rsc@swtch.com              > Nonetheless, it's an interesting exercise. Will probably use it in a       > data structures course some time in the future. If you want to       > implement the "obvious" recursive solution and still generate every       > possible string, you effectively need coroutines to do alternation.              Or lazy evaluation (same thing). Doug McIlroy's functional pearl       "Enumerating the strings of regular languages" in JFP (preprint at       http://www.cs.dartmouth.edu/~doug/nfa.ps.gz) gives elegant Haskell       code to generate texts both directly from the regular expression (the       grammar route) and from the equivalent automaton.              Russ              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca