CordyJ / Open-TuringPlus

Open Turing+ programming language compiler
Other
8 stars 2 forks source link

return statements not allowed at program toplevel #13

Open dnewhall opened 3 months ago

dnewhall commented 3 months ago

For the following trivial program:

put "Got here"
return
put "Shouldn't get here"

tpc errors saying "'return' can be used only in a subprogram"

However, the Turing Report on pg. 33 says return "causes immediate return from a program or a procedure" so it should be allowed at the toplevel to exit a program. I checked the Turing Plus Report and it doesn't mention any changes regarding that statement's semantics.

CordyJ commented 3 months ago

Yes, this is a Turing+ difference that came with the change to separate compilation with exception handling. Doesn't appear to be documented.