Re: Syntax

Raul Deluth Miller-Rockwell <>
Thu, 5 Dec 91 00:24:31 est

          From comp.compilers

Related articles
Current work in compiler/language design. hackeron@Athena.MIT.EDU (Harris L. Gilliam - MIT Project Athena) (1991-11-10)
Syntax andy@SAIL.Stanford.EDU (1991-11-27)
Re: Syntax (1991-12-03)
Re: Syntax (1991-12-04)
Re: Syntax (Raul Deluth Miller-Rockwell) (1991-12-05)
Re: Syntax (1991-12-05)
Re: Syntax (Eric A. Anderson) (1991-12-05)
Re: Syntax (1991-12-05)
Re: Syntax (1991-12-04)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Raul Deluth Miller-Rockwell <>
Keywords: syntax, design
Organization: Compilers Central
References: 91-11-030 91-12-012
Date: Thu, 5 Dec 91 00:24:31 est

Dale R Worley:
      In article 91-12-004 andy@SAIL.Stanford.EDU (Andy
      Freeman) writes:

            [...] the "infix" languages don't agree on precedence because
            people don't, at least for operators other than *, +, -, and /.
            (BTW - There isn't even agreement on how consecutive - and /s
            are grouped.)

      It's worse than that -- in Snobol 4, "-" has a lower precedence
      than "+", that is, "a + b - c + d" is parsed as "(a + b) - (c +
      d)". Similarly for "*" and "/".

And in J, "%" is used for division, and "/" is a meta-function which
affects how the function it's modifying gets its arguments. Also, "*"
and "%" are at the same precedence as "+" and "-", so that a*b+c*d is
parsed as a * (b + (c * d)).

      And let's not forget associativity -- how is "a ** b ** c" to be

In J, it would be parsed a * (* (b * (* c))). [J uses "^" to indicate
exponentiation, monadic "*" indicates signum, "dereferencing a
pointer" is indicated by monadic ">".]

I'm not sure what this has to do with compilers except to point out
yet again that standards are limited in scope.

It's also interesting to note that J allows user defined prefix, infix
and postfix operators. A lot of this can be supported in a YACC based
parser simply by having the lexical analyzer look up identifiers in
the symbol table(s). However, I think an operator precedence parser
is better suited to this task.

Raul Deluth Miller-Rockwell <>
[For people unfamiliar with it, J is a new dialect of APL. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.