summaryrefslogtreecommitdiff
path: root/src/ast.rs
diff options
context:
space:
mode:
authorJJ2023-04-10 04:22:37 +0000
committerJJ2023-04-10 04:22:37 +0000
commitbe249407be3e4f63548bab9e0cc23ee1daf82a4a (patch)
tree2f49f0f76ee5eaa63542279ada7f7cedcd22eec0 /src/ast.rs
parent488bbc6816cbbe8a0ab95ce6c6fd391e9c9351c4 (diff)
bidirectional wip
Diffstat (limited to 'src/ast.rs')
-rw-r--r--src/ast.rs9
1 files changed, 5 insertions, 4 deletions
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<Expression>, 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<Expression>},
Application{func: Box<Expression>, arg: Box<Expression>},
Conditional{if_cond: Box<Expression>, if_then: Box<Expression>, if_else: Box<Expression>}
}
// _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<Type>),
// Record(Vec<Type>),
- // Function{from: Box<Type>, to: Box<Type>},
+ Function{from: Box<Type>, to: Box<Type>},
}
// 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