Skip to content

Commit

Permalink
Add parsing for let ... in ... statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
MxmUrw committed Aug 10, 2024
1 parent 0138fd6 commit b6031b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Parser/Definition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ basetermParser = choice
, try $ string "tt" >> return TT
, try $ between (string "(") (string ")") termParser'
, try $ between (string "{") (string "}") (Mod Box <$> termParser') -- mod for box modality
, try $ string "let" >> white' >> LetIn <$> argParser <* white' <* string "=" <* white' <*> termParser' <* spaces <* string "in" <* white' <*> termParser'

, try $ string "fst" >> white' >> Fst <$> basetermParser
, try $ string "snd" >> white' >> Snd <$> basetermParser
Expand Down
4 changes: 3 additions & 1 deletion test/examples/globalize-sum.kami
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ aa : Unit
aa = tt

gl : ((Unit + Unit) @ 0) -> ((Unit @ 0) + (Unit @ 0))
gl x = (\(y : {(Unit @ 0) + (Unit @ 0)} @ 0) -> y) (gl0 x)
gl x = let y = gl0 x
in y

// (\(y : {(Unit @ 0) + (Unit @ 0)} @ 0) -> y) (gl0 x)
// gl0 x
// gl0 (xs @ 0) = either xs (\x -> {left (x @ 0)}) g @ 0
// gl0 (left xleft @ 0) = {left (x @ 0)} @ 0
Expand Down

0 comments on commit b6031b9

Please sign in to comment.