merge new changes from master into semantic errors #10

Merged
al4423 merged 19 commits from master into semantic-error-messages 2025-02-06 23:39:05 +00:00
7 changed files with 173 additions and 474 deletions
Showing only changes of commit 057d625464 - Show all commits

View File

@@ -73,11 +73,15 @@ object parser {
)
private lazy val `<pair-elem-type>` =
(`<base-type>` <**> (`<array-type>` </> identity)) |
`<pair-type>` ~> ((`<pair-elems-type>` <**> `<array-type>`.explain("for a pair to contain a pair type, it must be an array or erased pair")) </> UntypedPairType)
`<pair-type>` ~> ((`<pair-elems-type>` <**> `<array-type>`.explain(
"for a pair to contain a pair type, it must be an array or erased pair"
)) </> UntypedPairType)
// TODO: better explanation here?
// Statements
private lazy val `<program>` = Program(
"begin" ~> many(atomic(`<type>`.label("function declaration") <~> `<ident>` <~ "(") <**> `<partial-func-decl>`).label("function declaration"),
"begin" ~> many(
atomic(`<type>`.label("function declaration") <~> `<ident>` <~ "(") <**> `<partial-func-decl>`
).label("function declaration"),
`<stmt>`.label("main program body") <~ "end"
)
private lazy val `<partial-func-decl>` =