Skip to content

Instantly share code, notes, and snippets.

@dvanhorn
Created July 31, 2012 07:34
Show Gist options
  • Save dvanhorn/3214531 to your computer and use it in GitHub Desktop.
Save dvanhorn/3214531 to your computer and use it in GitHub Desktop.
Sweet notation in Redex
#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