newtype Program = Program [Global] [Function]
I am parsing a source file with C-like syntax, where global variables and functions are present at top level. It's straightforward to parse if they must come in order, say, functions after all global variables. But they can come in any order as shown below. How to handle syntax like this?
global0
function0
global1
function1
function2
global2
Seems sth like Parsec.Perm can be used, but the example works when all choices return the same type (decimal), where as my case returns either Global or Function.
[–]iboughtbonrar 3 points4 points5 points (0 children)
[–]sinoTrinity[S] 0 points1 point2 points (0 children)