Open grosu opened 10 years ago
Let me try again with with the quotes trick: ''' fslwork$ more tokens.k module TOKENS syntax ABCD ::= Token{[a]} syntax EFGH ::= Token{[a]} endmodule fslwork$ kompile tokens.k fslwork$ krun --parser "kast --parser ground -e" "isABCD(a)"
fslwork$ krun --parser "kast --parser ground -e" "isEFGH(b)"
fslwork$ krun --parser "kast --parser ground -e" "isEFGH(a)"
fslwork$ '''
Hm, maybe backquotes (github wiki sucks):
fslwork$ more tokens.k
module TOKENS
syntax ABCD ::= Token{[a]}
syntax EFGH ::= Token{[a]}
endmodule
fslwork$ kompile tokens.k
fslwork$ krun --parser "kast --parser ground -e" "isABCD(a)"
<k>
isABCD(a)
</k>
fslwork$ krun --parser "kast --parser ground -e" "isEFGH(b)"
<k>
isEFGH(b)
</k>
fslwork$ krun --parser "kast --parser ground -e" "isEFGH(a)"
<k>
true
</k>
fslwork$
This is what I found out.
Sona:issue#120 andrei$ kast --parser ground -e "isABCD(a)"
`()(isABCD, _
(_`)(#token("EFGH", "a"), .KList))
[Warning] Parser: Parsing ambiguity. Arbitrarily choosing the first.
1:
a
2:
a
3:
a
File: Command line
Location: (1,8,1,9)
Compilation Phase: Ambiguity filter
I think krun should forward stderr from the external parser. This should avoid problems like above in the future. I will reopen and rename the issue.
@dwightguth, I think this should be trivial for you since you are most familiar with the krun code.
This is just great, I wasted 2 hours today until I finally localized and minimized it:
fslwork$ more tokens.k module TOKENS syntax ABCD ::= Token{[a]} syntax EFGH ::= Token{[a]} endmodule fslwork$ kompile tokens.k fslwork$ krun --parser "kast --parser ground -e" "isABCD(a)"
fslwork$ krun --parser "kast --parser ground -e" "isEFGH(b)"
fslwork$ krun --parser "kast --parser ground -e" "isEFGH(a)"
fslwork$