From be249407be3e4f63548bab9e0cc23ee1daf82a4a Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 9 Apr 2023 21:22:37 -0700 Subject: bidirectional wip --- src/ast.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ast.rs') diff --git a/src/ast.rs b/src/ast.rs index 68522ce..0a2afdb 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -12,16 +12,17 @@ pub enum Expression { Annotation{expr: Box, kind: Type}, Constant{term: Term}, Variable{id: Identifier}, + // note: we keep parameters as an Identifier because we annotate the WHOLE Abstraction Abstraction{param: Identifier, func: Box}, Application{func: Box, arg: Box}, Conditional{if_cond: Box, if_then: Box, if_else: Box} } // _every_ type in our language is represented as this and interpreted as a type. -// how to store more data than fits... hmm +// how to store more data than fits... hmm... a problem for later pub type Value = u64; -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum Type { Empty, Unit, @@ -32,11 +33,11 @@ pub enum Type { // String, // Enum(Vec), // Record(Vec), - // Function{from: Box, to: Box}, + Function{from: Box, to: Box}, } // this means that functions cannot have types? unless we put them as empty values ig -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Term { pub val: Value, pub kind: Type, // currently useless / redundant: will be useful for casting -- cgit v1.2.3-70-g09d2