Created
May 19, 2011 22:35
-
-
Save rocketnia/981963 to your computer and use it in GitHub Desktop.
An Arc-like sketch of an s-expression Esterel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://en.wikipedia.org/wiki/Esterel | |
(nothing) | |
(pause) | |
(do p q ...) | |
(par p q ...) | |
(forever p) | |
(let s p) | |
(emit s) | |
(ifelse s p q) | |
(suspend-if s p) | |
(catch trap p) | |
(throw trap) | |
(esterel-mac halt () | |
'(forever:pause)) | |
(esterel-mac sustain (x) | |
`(forever:do (emit s) (pause))) | |
(esterel-mac if body | |
(iflet (first . rest) body | |
(iflet (then . rest) rest | |
`(ifelse ,first ,then (if ,@rest)) | |
first) | |
'(nothing))) | |
(esterel-mac await (s) | |
(w/uniq trap | |
`(catch ,trap (forever:do (pause) (if ,s (throw ,trap)))))) | |
(esterel-mac await-immediate (s) | |
(w/uniq trap | |
`(catch ,trap (forever:do (if ,s (throw ,trap)) (pause))))) | |
(esterel-mac suspend-if-immediate (s p) | |
`(suspend-if ,s (do (if ,s (pause)) ,p))) | |
(esterel-mac abortpar body | |
(w/uniq trap | |
`(catch ,trap (par ,@(map [do `(do ,_ (exit ,trap))] body))))) | |
(esterel-mac weak-abort-if (s p) | |
`(abortpar ,p (await ,s))) | |
(esterel-mac weak-abort-if-immediate (s p) | |
`(abortpar ,p (await-immediate ,s))) | |
(esterel-mac abort-if (s p) | |
`(weak-abort-if ,s (suspend-if ,s ,p))) | |
(esterel-mac abort-if-immediate (s p) | |
`(weak-abort-if-immediate ,s (suspend-if ,s ,p))) | |
(esterel-mac do-while (s p) | |
`(forever:abort ,s (do ,p (halt)))) | |
(esterel-mac while (s p) | |
`(do (await ,s) (do-while ,s ,p))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment