2 ms·
Pascal is fully self-consistent here: in it, semicolon is a statement separator, not a statement terminator. Since the statement before "end" is the last one in
by int_19h 5y ago
Pascal is fully self-consistent here: in it, semicolon is a statement separator, not a statement terminator. Since the statement before "end" is the last one in the block, there's no statement to separate it from with a trailing semicolon, and so it's a syntax error.
- stkdump 5y agoIt's not a syntax error.
- denton-scratch 5y agoCorrect - the redundant semi-colon denotes an empty statement.
- barrkel 5y agoPascal permits a null production for the statement grammar. simple-statement = empty-statement | assignment-statement | procedure-statement | goto-statement . empty-statement = . from http://www.pascal-central.com/iso7185.html#6.8%20Statements http://www.pascal-central.com/iso7185.html#6.8%20Statements (ISO 7185 Pascal) In practice the separator-vs-terminator distinction mostly shows up in if-statements: if foo then bar else baz; I believe that anywhere else in a statement context, you can put in as many extra ';' as you like and it won't make a difference. And of course you can drop the final ';' before 'end' or 'until'.