From 988d0dbb533d3c33249f3a1a54d60352fd892299 Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 4 May 2023 23:03:11 +0200 Subject: [PATCH] moved stuff --- Grammar.cf | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Grammar.cf b/Grammar.cf index 3f89e86..f422fd7 100644 --- a/Grammar.cf +++ b/Grammar.cf @@ -14,7 +14,7 @@ DSig. Def ::= Sig; DData. Def ::= Data; internal Sig. Sig ::= LIdent ":" Type; - SigS. Sig ::= VarName ":" Type; + SigS. Sig ::= VarName ":" Type; internal Bind. Bind ::= LIdent [LIdent] "=" Exp; BindS. Bind ::= VarName [LIdent] "=" Exp; @@ -42,6 +42,18 @@ Data. Data ::= "data" Type "where" "{" [Inj] "}" ; Inj. Inj ::= UIdent ":" Type ; +------------------------------------------------------------------------------- +-- * PATTERN MATCHING +------------------------------------------------------------------------------- + +Branch. Branch ::= Pattern "=>" Exp ; + +PVar. Pattern1 ::= LIdent; +PLit. Pattern1 ::= Lit; +PCatch. Pattern1 ::= "_"; +PEnum. Pattern1 ::= UIdent; +PInj. Pattern ::= UIdent [Pattern1]; + ------------------------------------------------------------------------------- -- * Expressions ------------------------------------------------------------------------------- @@ -70,18 +82,6 @@ define infixSymbol e1 vn e3 = EApp (EApp (EVarS (VSymbol vn)) e1) e3; LInt. Lit ::= Integer; LChar. Lit ::= Char; -------------------------------------------------------------------------------- --- * PATTERN MATCHING -------------------------------------------------------------------------------- - -Branch. Branch ::= Pattern "=>" Exp ; - -PVar. Pattern1 ::= LIdent; -PLit. Pattern1 ::= Lit; -PCatch. Pattern1 ::= "_"; -PEnum. Pattern1 ::= UIdent; -PInj. Pattern ::= UIdent [Pattern1]; - ------------------------------------------------------------------------------- -- * AUX -------------------------------------------------------------------------------