[plt-scheme] Code generation question from Shriram's Automata via Macros

From: Grant Rettke (grettke at acm.org)
Date: Wed Aug 1 23:19:31 EDT 2007

I just read Shriram's _Automata_via_Macros

http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/

and it was very helpful.

It includes a macro for creating state machines defined by a little
language that looks like this:

; An automaton that recognizes the language c(ad)*r
(define m (automaton init
                     (init :
                           (c -> more))
                     (more :
                           (a -> more)
                           (d -> more)
                           (r -> end))
                     (end : )))

The macro, of course, expands it into a little state machine.

Suppose I took that definition and did something like:

(define the-data
"(automaton init
                     (init :
                           (c -> more))
                     (more :
                           (a -> more)
                           (d -> more)
                           (r -> end))
                     (end : )))"

First question, how would I got about evaluating it and binding it to
a value like in previous example?

Second, how could I take the definition of 'the-data' and use that
language to, for example, create a graphviz file that represented the
state machine?


Posted on the users mailing list.