From: | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
Newsgroups: | comp.compilers |
Date: | Mon, 20 May 2013 10:53:39 GMT |
Organization: | Institut fuer Computersprachen, Technische Universitaet Wien |
References: | 13-05-010 |
Keywords: | parse, theory |
Posted-Date: | 20 May 2013 15:04:48 EDT |
"Costello, Roger L." <costello@mitre.org> writes:
>The poster makes the point that most programming languages define a
>context-free core, and then have additional algorithms which run on the parse
>tree to filter out constructs that are illegal in the language:
...
>[ [...] it also permits much better
>error messages. -John]
That depends on the syntax of the language. E.g., at one time
Modula-2 was the language used in our introductory programming course
25 years ago, our students used to write things like
a<3 AND b<3
and the compiler reported a type error (a and b were of type INTEGER).
But it really was a syntax error. The students should have written
(a<3) AND (b<3)
because the implicit binding was
a<(3 AND b)<3
and "3 AND b" was a type error. This error message confused the
students no end.
- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/
Return to the
comp.compilers page.
Search the
comp.compilers archives again.