Skip to content

Commit a3f2b79

Browse files
committed
Rename +T to Sum and *T to Prod
1 parent 51e1c8f commit a3f2b79

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/Lam/Parser/Lexer.x

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ tokens :-
3030
<0> "DEFINE" { tok Define }
3131
<0> "LOAD" { tok Load }
3232
<0> "READ" { tok Read }
33+
<0> "Sum" { tok SumT }
34+
<0> "Prod" { tok ProdT }
3335
<0> ":" { tok Colon }
3436
<0> "::" { tok TypeColon }
3537
<0> ":=" { tok ColonEq }
@@ -57,8 +59,6 @@ tokens :-
5759
<0> "of" { tok Of }
5860
<0> "|" { tok Pipe }
5961
<0> "as" { tok As }
60-
<0> "+T" { tok PlusT }
61-
<0> "*T" { tok ProdT }
6262
<0> @id { tok (Var "") }
6363
<0> @path { tok (Path "") }
6464
<0> @digits { tok (NumVal 0) }
@@ -112,7 +112,7 @@ data Token =
112112
| Pipe
113113
| As
114114
| ProdT
115-
| PlusT
115+
| SumT
116116
| EOF
117117
deriving Show
118118

src/Lam/Parser/Parser.y

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ import Lam.Parser.Lexer qualified as L
2727
%left "<" ">"
2828
%left "&&" "||"
2929
%left "+" "-"
30-
%right "+T"
3130
%left "*"
32-
%right "*T"
3331
%left "!"
3432
%left "proj1"
3533
%left "proj2"
@@ -82,8 +80,8 @@ import Lam.Parser.Lexer qualified as L
8280
"of" { L.Of }
8381
"|" { L.Pipe }
8482
"as" { L.As }
85-
"+T" { L.PlusT }
86-
"*T" { L.ProdT }
83+
"Sum" { L.SumT }
84+
"Prod" { L.ProdT }
8785
%%
8886

8987

@@ -202,8 +200,8 @@ RawTypeL :: { RawTypeL }
202200
| "Int" { RawIntT }
203201
| "Bool" { RawBoolT }
204202
| var { FreeType $1 }
205-
| RawTypeL "*T" RawTypeL { RawProd $1 $3 }
206-
| RawTypeL "+T" RawTypeL { RawSum $1 $3 }
203+
| "Prod" RawTypeL RawTypeL { RawProd $2 $3 }
204+
| "Sum" RawTypeL RawTypeL { RawSum $2 $3 }
207205
| ParType { $1 }
208206

209207
ParType : "(" RawTypeL ")" { $2 }

src/Lam/Utils.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ prettyPrintType BoolT = "Bool"
2626
prettyPrintType IntT = "Int"
2727
prettyPrintType U = "U"
2828
prettyPrintType (Prod t1 t2) =
29-
unwords [ "(", prettyPrintType t1, "*T", prettyPrintType t2, ")" ]
29+
unwords [ "( Prod", prettyPrintType t1, prettyPrintType t2, ")" ]
3030
prettyPrintType (Sum t1 t2) =
31-
unwords [ "(", prettyPrintType t1, "+T", prettyPrintType t2, ")" ]
31+
unwords [ "( Sum", prettyPrintType t1, prettyPrintType t2, ")" ]
3232
prettyPrintType (Arrow t1 t2) =
3333
unwords [ "(", prettyPrintType t1, "=>", prettyPrintType t2, ")" ]
3434

0 commit comments

Comments
 (0)