commit 8b81c9369262684478afaf1c15b5f14f833540b9
parent 4e48285d7fe5e85fe6e9866ac07be374d1a780ab
Author: Stephen Chang <stchang@ccs.neu.edu>
Date: Fri, 22 Jul 2016 15:49:58 -0400
typed fsm lang uses choose from typed rosette
Diffstat:
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/turnstile/examples/rosette/fsm.rkt b/turnstile/examples/rosette/fsm.rkt
@@ -7,11 +7,13 @@
(require (prefix-in ro: rosette/lib/synthax))
(require (prefix-in fsm: sdsl/fsm/fsm))
(require (only-in sdsl/fsm/fsm reject verify-automaton debug-automaton synthesize-automaton))
+(provide (rename-out [rosette:choose ?]))
(require (for-syntax lens unstable/lens))
(define-base-types FSM State Pict)
+;; extend rosette:#%datum to handle regexp literals
(define-typed-syntax #%datum
[(_ . v) ≫
#:when (regexp? (syntax-e #'v))
@@ -21,6 +23,7 @@
--------
[_ ≻ (rosette:#%datum . v)]])
+;; extend rosette:#%app to work with FSM
(define-typed-syntax app #:export-as #%app
[(_ f e) ≫
[⊢ [f ≫ f- ⇐ : FSM]]
@@ -49,15 +52,6 @@
(define-primop reject : State)
-;(provide (rename-out [fsm:? ?]))
-(define-typed-syntax ?
- [(ch e ...+) ≫
- [⊢ [e ≫ e- ⇒ : ty]] ...
- --------
- ;; the #'choose identifier itself must have the location of its use
- ;; see define-synthax implementation, specifically syntax/source in utils
- [⊢ [_ ≫ (#,(syntax/loc #'ch ro:choose) e- ...) ⇒ : (⊔ ty ...)]]])
-
;; (define (apply-FSM f v) (f v))
;; (define-primop apply-FSM : (→ FSM (List Symbol) Bool))
diff --git a/turnstile/examples/rosette/rosette.rkt b/turnstile/examples/rosette/rosette.rkt
@@ -34,10 +34,12 @@
(ro:define-symbolic y ... pred-))]])
(define-typed-syntax choose
- [(_ e ...+) ≫
+ [(ch e ...+) ≫
[⊢ [e ≫ e- ⇒ : ty]] ...
--------
- [⊢ [_ ≫ (ro:choose e ...) ⇒ : (⊔ ty ...)]]])
+ ;; the #'choose identifier itself must have the location of its use
+ ;; see define-synthax implementation, specifically syntax/source in utils
+ [⊢ [_ ≫ (#,(syntax/loc #'ch ro:choose) e- ...) ⇒ : (⊔ ty ...)]]])
(define-typed-syntax app #:export-as #%app
[(_ e_fn e_arg ...) ≫