🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6366

Re: Language Design

#6366
From: Clive
Date: Wed, 29 Mar 1989 12:30
35 lines
2172 bytes
In article <8903250115.AA08564@yorkville.csri.toronto.edu>, norvell@csri.toronto.edu (Theodore Stevens Norvell) writes:
> The real question is what do you want to call syntax and what do you
> want to call static semantics.  In the absence of any definitive definition,
> this is a matter of taste and convenience to the implementor.

For a new approach to this, look at:

"The Revised Report on the Algorithmic Language Algol 68".
- van Wijngaarden et al

This approached this problem by defining the grammar using another (context-free)
grammar (hence the term 'two-level grammar'). This meant that things like not using
a variable before it was defined were specified in the *grammar* - very nifty.
To do this, the second level grammar had a non-terminal called NEST which expanded
to sequences like "int a char b" and so on. Productions of the first level grammar
had NESTs scattered in them (translating to C):

    TYPE NEST variable : TYPE NEST IDENTIFIER, where TYPE IDENTIFIER declared in NEST .

(comma means "and"). The production

    where TYPE IDENTIFIER declared in NEST

expands to "empty" if the variable was declared, and to a nonterminal with no
production rule if it isn't - thus the grammar can't generate a program with an
undeclared variable. (Algol 68 had user-definable types, like C).

They did all kinds of things with this - type checking of assignments and operator
arguments, and context sensitive automatic type conversion come to mind.

Pity it was so hard to parse :-)
-- 
Clive D.W. Feather           clive@ixi.uucp
IXI Limited                  ...!mcvax!ukc!acorn!ixi!clive (untested)
                             +44 223 462 131
Technical Details
Message-ID: <125@ixi.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!acorn!ixi!clive
References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <8903250115.AA08564@yorkville.csri.toronto.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!acorn!ixi!clive
From: clive@ixi.UUCP (Clive)
Newsgroups: comp.lang.misc
Subject: Re: Language Design
Summary: What about Algol 68 ?
Message-ID: <125@ixi.UUCP>
Date: 29 Mar 89 12:30:33 GMT
References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <8903250115.AA08564@yorkville.csri.toronto.edu>
Organization: none
Lines: 35