문제

It seems that in Rascal a syntax declaration must come before a data declaration. Is that true? My experience is that if I put a syntax declaration after a data declaration, I got a parse error. Why is it a parse error?

도움이 되었습니까?

해결책

Yes. Syntax declarations must come first in the file.

The reasoning is (I believe) that it should be simple to extract the grammar needed to parse the rest of the file.

You can of course always work around this if necessary by putting your type declarations in a separate file (probably only necessary if you need to add weirdo annotations to your grammar productions).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top