diff --git a/lang/parser/src/cst.rs b/lang/parser/src/cst.rs index 177f2a98d..628254335 100644 --- a/lang/parser/src/cst.rs +++ b/lang/parser/src/cst.rs @@ -35,6 +35,7 @@ pub enum Decl { Codata(Codata), Def(Def), Codef(Codef), + Let(Let), } #[derive(Debug, Clone)] @@ -99,6 +100,17 @@ pub struct Codef { pub body: Match, } +#[derive(Debug, Clone)] +pub struct Let { + pub span: Span, + pub doc: Option, + pub name: Ident, + pub attr: Attribute, + pub params: Telescope, + pub typ: Rc, + pub body: Rc, +} + #[derive(Debug, Clone)] pub struct Match { pub span: Span, diff --git a/lang/parser/src/grammar/cst.lalrpop b/lang/parser/src/grammar/cst.lalrpop index 43c4a26d8..5557c66cb 100644 --- a/lang/parser/src/grammar/cst.lalrpop +++ b/lang/parser/src/grammar/cst.lalrpop @@ -22,7 +22,7 @@ match { r"0|[1-9][0-9]*", // Keywords "data", "codata", - "def", "codef", + "def", "codef", "let", "match", "as", "comatch", "absurd", "..absurd", "Type", @@ -95,6 +95,8 @@ pub Decl: Decl = { "codata" "{" > "}" => Decl::Codata(Codata { span: span(l, r), doc, name, attr, params, dtors }), "def" "." ":" "{" "}" => Decl::Def(Def { span: span(l, r), doc, name, attr, params, scrutinee, ret_typ, body }), "codef" ":" "{" "}" => Decl::Codef(Codef { span: span(l, r), doc, name, attr, params, typ, body }), + "let" ":" "{" "}" => + Decl::Let(Let { span: span(l,r), doc, name, attr, params, typ, body }), } Ctor: Ctor = {