Article View: comp.lang.oberon
Article #846Re: EBNF for Oberon2?
From: oswald
Date: Fri, 26 Jan 1996 07:13
Date: Fri, 26 Jan 1996 07:13
36 lines
1641 bytes
1641 bytes
Geoff Elgey kindly asked:
> I am looking for an EBNF (or grammar) for Oberon2. There is a grammar for
> Oberon at the ETH site, but it does not satisfy the LL(1) condition.
True, but the LL(1) violations are restricted to only few cases. The ones that
come to mind are:
- assignment and procedure call both start with a designator. This can be
factored out in the grammar, if necessary.
- the distinction between qualidents ("Module.Ident") and record fields
in factors.
- the distinction between function calls and type guards in factor.
Are you planning to write a front end for Oberon-2? (I'm asking because
I saw you are also interested in Coco/R.) Coco/R allows you to insert
semantic actions in the grammar before any token is read, which can be
used to abort the parsing procedure prematurely (e.g. in qualident if the
first identifier does not denote a module).
From the top of my head (VERY inaccurate):
qualident<VAR sym: Symbol> =
ident<id>
(. GetSymbol(id, sym) .)
[
(. IF ~IsModule(sym) THEN RETURN END .)
"." ident<id>
(. GetImport(sym, id) .)
].
> Thanks.
Erich Oswald
Institute for Computer Systems
ETH Zurich, Switzerland
oswald@inf.ethz.ch
Technical Details
Message-ID:
<4e9uv3$9cb@neptune.ethz.ch>Path:
arc1-ca.pugleaf.net!inf.ethz.ch!newsReferences:
<4e46aa$j62@stork.qut.edu.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!inf.ethz.ch!news From: oswald@inf.ethz.ch Newsgroups: comp.lang.oberon Subject: Re: EBNF for Oberon2? Followup-To: comp.lang.oberon Date: 26 Jan 1996 07:13:39 GMT Organization: Dept. Informatik, Swiss Federal Institute of Technology Message-ID: <4e9uv3$9cb@neptune.ethz.ch> References: <4e46aa$j62@stork.qut.edu.au> NNTP-Posting-Host: anthrax.inf.ethz.ch X-Newsreader: NewsReader for Oberon (ejz)