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

From: Noel Welsh (noelwelsh at gmail.com)
Date: Thu Aug 2 05:56:11 EDT 2007

On 8/2/07, Grant Rettke <grettke at acm.org> wrote:
> 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?

http://schemecookbook.org/Cookbook/StringEval

> 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?

Easy.  Just walk the data structure and spit out the right strings.  I
do it all the time for POMDPs, which are kinda an extended finite
state machine.

N.


Posted on the users mailing list.