fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
5 stars 0 forks source link

Better error message for pi type literals where lower expressions are expected / in sequence literals #78

Open fmease opened 3 years ago

fmease commented 3 years ago

Sequence literals contain lower expressions. So naturally, we need to modify the subparser for lower expressions to account for pi type literals (even though they are invalid in this context). NB: We currently already do such gymnastics in the subparser for (de-)applications. Either we are forced to "duplicate" the logic (creating a helper function) or even better might be able to just move the logic from the application-subparser to the subparser for lower expressions.

Example 0

main = ['(n: Int) -> Int]

Current subpar output:

error[E010]: found `'`, but expected expression
 --> playground/wer.lushui:1:9
  |
1 | main = ['(n: Int) -> Int]
  |         ^ unexpected token
  |

Example 1

main = [(n: Int) -> Int]

Current subpar output:

error[E010]: found `:`, but expected `)`
 --> playground/wer.lushui:1:11
  |
1 | main = [(n: Int) -> Int]
  |           ^ unexpected token
  |

Example 2

main = [stop (n: Int) -> Int]