From: | Tony Finch <dot@dotat.at> |
Newsgroups: | comp.compilers |
Date: | 17 Jan 2011 17:28:25 +0000 (GMT) |
Organization: | dotat labs |
References: | 10-12-040 11-01-009 11-01-027 11-01-057 |
Keywords: | design, syntax |
Posted-Date: | 18 Jan 2011 01:02:39 EST |
Chris F Clark <cfc@shell01.TheWorld.com> wrote:
>
>Froma a grammar writing point of view, it is not particularly
>difficult to introduce PL/I style keywords to any LR grammar. The
>same changes should generally work for LL grammars also. If people
>are interested I can document them here.
>
>The harder question one has to ask is whether they make writing
>correct programs easier or harder. They certainly make more programs
>legal and lessen the burden of remembering all the keywords for a
>given language.
If you want this feature to work well then you have to design other
parts of the grammar to accommodate it.
Explicit statement delimiters help, because most keywords can only
occur at the start of a statement, or are only valid after a
particular statement-introducing keyword.
If you are using keywords to delimit blocks then block-dependent end
keywords are better, e.g. if..fi rather than if..end, so that the end
keyword doesn't become de facto reserved because it's special in so
many contexts. Or just use {..} punctuation.
>[IF THEN = ELSE THEN IF = ELSE; ELSE IF = THEN; -John]
Maybe we should re-introduce stropping using U+0332 COMBINING LOW LINE :-)
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
Return to the
comp.compilers page.
Search the
comp.compilers archives again.