Discussion:
Testing m2c on MCInit.mod
(too old to reply)
Nemo
2015-12-15 23:39:50 UTC
Permalink
My comments prefaced with "-->".

MCInit.mod
m2c Modula-2 Compiler & Translator, version 1.00
line: 40, column: 13, unexpected identifier 'C' found
expected symbol ';'
line: 40, column: 14, unexpected symbol ';' found
expected symbol '='
--> m2c does not accept 0C.

line: 55, column: 14, unexpected reserved word END found
expected identifier.
--> offending code follows with line numbers in comments.

Option = RECORD
minlength : CARDINAL;
maxlength : CARDINAL;
text : OptionText;
END; (*l. 55*)

line: 63, column: 52, unexpected symbol ':' found
expected symbol ')'
line: 64, column: 27, unexpected symbol ',' found
expected symbol ';'
--> offending code follows

PROCEDURE InitOption(optkind: OptionKind; opttext: OptionText;
min, max: CARDINAL); (*l. 64*)

line 70, column 5, error: semicolon at end of statement sequence
line 71, column 3, error: semicolon at end of statement sequence
line: 71, column: 17, unexpected symbol ';' found
expected symbol '.'
--> offending code follows

BEGIN
WITH options[optkind] DO
text := opttext;
minlength := min;
maxlength := max;
END; (*l. 70*)
END InitOption;

line: 172, column: 44, invalid character, offending character: '>'
--> "<>" not accpedted: offending code follows

WHILE (ix <= HIGH(ext)) AND (ext[ix] <> null) AND (*l. 172*)
(pos <= HIGH(fname)) DO

line: 206, column: 47, invalid character, offending character: '>'
line: 207, column: 28, invalid character, offending character: '>'
line: 207, column: 51, invalid character, offending character: '>'
--> all refer to "<>" not accepted

parse error count: 8
trijezdci
2015-12-16 06:12:20 UTC
Permalink
On Wednesday, 16 December 2015 08:42:12 UTC+9, Nemo wrote:

For PIM sources please use options --pim3 or --pim4.

Also, please use option --errant-semicolon, this will demote the error into a warning.

thanks.
trijezdci
2015-12-17 11:43:19 UTC
Permalink
Post by Nemo
MCInit.mod
All scenarios where semicolons following a sequence where semicolon is a separator are now being detected and reported, either as warnings (using option --errant-semicolon) or as errors (default):

(1) at the end of a field list sequence in record definitions
(2) at the end of a formal parameter list in procedure definitions
(3) at the and of a statement sequence

Further, all scenarios where an empty field list sequence or an empty statement sequence may occur are also reported as warnings.

The test file EmptyStmtSeq.mod which is also in the repo includes all scenarios.

Finally, there was a copy-paste artefact in formalParams and another bug in procedureType, both now fixed.

If you check out the latest version and run it with options --pim3 or --pim4 and --errant-semicolon your code will probably cause no more errors now.

thanks

Loading...