heptagon/examples/random/README

22 lines
830 B
Text
Raw Normal View History

Simple Markov chain simulation by external call to random() C function :
- random.epi : Heptagon interface containing the declaration of
random() function
- random.h, random.c : "glue" between actual random() C function and
function calls generated by Heptagon
- markov.ept : contains node "process", simulating a two-state Markov
chain, with probability p (constant) at each step to go from one
state to the other
Function "random" and node "process" are declared unsafe to avoid
optimization removing calls to "random" ("random" has side effects).
Compilation and simulation :
heptc random.epi
heptc -target c -s process -hepts markov.ept
gcc -I . -I markov_c -I /usr/local/lib/heptagon/c random.c markov_c/_main.c markov_c/markov.c markov_c/markov_types.c -o markov
hepts -mod Markov -node process -exec ./markov