Working example and README

This commit is contained in:
Chris Fallin
2021-09-04 20:25:10 -07:00
parent d7efd9f219
commit 4a2cd78827
5 changed files with 52 additions and 10 deletions

View File

@@ -0,0 +1,21 @@
(type u32 (primitive u32))
(type A (enum (A1 (x u32)) (A2 (x u32))))
(type B (enum (B1 (x u32)) (B2 (x u32))))
(decl Input (A) u32)
(extractor Input get_input) ;; fn get_input<C>(ctx: &mut C, ret: u32) -> Option<(A,)>
(decl Lower (A) B)
(rule
(Lower (A.A1 sub @ (Input (A.A2 42))))
(B.B2 sub))
(decl Extractor (B) A)
(rule
(A.A2 x)
(Extractor (B.B1 x)))
(rule
(Lower (Extractor b))
b)

View File

@@ -0,0 +1,8 @@
pub fn get_input<C>(ctx: &mut C, x: u32) -> Option<(test::A,)> {
None
}
fn main() {}
mod test;