|precedences vs. hierarchy firstname.lastname@example.org (Andreas Schramm) (2016-06-06)|
|Re: precedences vs. hierarchy email@example.com (Dmitry A. Kazakov) (2016-06-06)|
|Re: precedences vs. hierarchy firstname.lastname@example.org (George Neuner) (2016-06-06)|
|Re: precedences vs. hierarchy email@example.com (2016-06-06)|
|precedences vs. hierarchy firstname.lastname@example.org (SLK Mail) (2016-06-07)|
|Re: precedences vs. hierarchy email@example.com (Kaz Kylheku) (2016-06-07)|
|Re: precedences vs. hierarchy firstname.lastname@example.org (Dmitry A. Kazakov) (2016-06-07)|
|Re: precedences vs. hierarchy email@example.com (2016-06-08)|
|Example: The Full Syntax Of Prolog (Re: precedences vs. hierarchy) firstname.lastname@example.org (2016-08-24)|
|Date:||Mon, 6 Jun 2016 14:01:17 -0700 (PDT)|
|Injection-Info:||miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="24153"; mail-complaints-to="email@example.com"|
|Posted-Date:||07 Jun 2016 10:54:55 EDT|
On Monday, June 6, 2016 at 7:35:45 AM UTC-5, Andreas Schramm wrote:
> (i) by precedence and associativity declarations, and
> (ii) by a hierarchy of non-terminals.
> are they equally respected approaches?
The latter is strictly more powerful than the former. In particular,
hierarchies can be circular or out of sequence, like the expression syntax in
C! Levels "Ex13" and "Ex14" here
Fortran used a the same approach as classical philology textbooks on language
in the 1950's and 1966; then went over to a kind of precedence syntax in the
1977 standard. I think the latest standard uses non-terminal tagging.
Prolog's expression syntax is non-terminal tagged (the "term" is the only real
non-terminal in the language).
From the vantage point of a parser -- seen as a PDT -- the thing you actually
want is a way to do relative comparisons with a finite lookahead sequence (of
typically just one token) versus your current context. So in fact, neither
approach described is actually the best, but one which has an "Action Table"
that plots contexts versus lookaheads (subcategorizing each into groups to
avoid duplicate rows and columns). When a context is favored you reduce you
carry out the action predicated on it (usually a reduce), while when a
lookahead is favored you carry out the action predicated on it (normally a
If you diagram the table like a quilt or tapestry, so that a vertical line
(and broken horizontal line woven "underneath" it) favors the column header,
while a horizontal line (and broken vertical line woven "underneath" it)
favors the row header, then a linearly-ordered hierarchy will show up as a
regular pattern in the tapestry. with horizontal lines dominating on a side
toward one of the corners of the weave, while the vertical lines dominate on
the opposite end.
The hierarchy tacit in the action table need not be linearly ordered at all
but can be twisted and knotted, even transcending what can be described by a
labeling of non-terminals. So this way is strictly more powerful than either
of the two methods described.
Return to the
Search the comp.compilers archives again.