Created
July 31, 2012 07:34
-
-
Save dvanhorn/3214531 to your computer and use it in GitHub Desktop.
Sweet notation in Redex
This file contains hidden or 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
| #lang planet asumu/sweet racket | |
| require rename-in(redex [term quote]) | |
| define-language lang | |
| e n | |
| δ1(e) | |
| δ2(e e) | |
| δ1 √ add1 sub1 | |
| δ2 + - * / | |
| E hole | |
| δ1(E) | |
| δ2(e E) | |
| δ2(E e) | |
| n number | |
| define v | |
| reduction-relation lang | |
| { √(n) --> ,sqrt('n) } | |
| { add1(n) --> ,add1('n) } | |
| { sub1(n) --> ,sub1('n) } | |
| { +(n_1 n_2) --> ,+('n_1 'n_2) } | |
| { -(n_1 n_2) --> ,-('n_1 'n_2) } | |
| { *(n_1 n_2) --> ,*('n_1 'n_2) } | |
| { /(n_1 n_2) --> ,/('n_1 'n_2) } | |
| define -->_v | |
| context-closure v lang E | |
| traces -->_v '-(*(√(36) /(1 2)) +(1 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment