ChildsplayOSU / bogl

Haskell implementation of the BoGL language
https://bogl.engr.oregonstate.edu
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

Type definitions should not be accepted after value definitions #182

Open MartinErwig opened 3 years ago

MartinErwig commented 3 years ago

Type definitions should not be accepted after the first value definition. E.g., the following program should be rejected by the parser.

game Error_TypeDefinitionAfterValueDefinition

x : Int
x = 3

type Foo = {A,B}

y : Foo
y = A
montymxb commented 3 years ago

For whoever is interested it would be worth looking at Parser.hs 477-479. This allows declarations to be mixed with type defs. Removing the type defs here would prevent this from happening, but one would also need to make sure type defs can follow an input type def as seen in Parser.hs 528.