[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

It seems to be overlooked that, often, it is not possible to perform identifier 
scope resolution during parsing (at least, not for what I take to be the 
standard meaning of the term “parsing”).  For example, in SML there is a form 
of declaration “open S1. … Sn” that brings into scope the identifiers 
determined by the type (ie, signature) of the path of structures.  The parser 
can’t know this information; it is available only during type checking.  In 
particular, it is not possible to examine the program text as such, find an 
identifier, and point to its binding site without also performing type 
checking.  Although the terminology is not very precise, I would say that this 
is nevertheless “static scope”, because type checking is done statically 
(without execution), but one may not want to call it “lexical” (and so much the 
worse for that term, it being too simple-minded for practical purposes).  Some 
time ago, as I recall, Francois Pottier wrote a paper studying a variety of 
exotic scoping concepts for PL’s, none of which would be “lexical” in this 
simple sense.

Again as a matter of terminology, I would argue that there is no such thing as 
“dynamic scoping”.  I think that is misleading terminology arising from 
confusing various things, such as classes, symbols, tags, and state, with 
scope.  For example, even when dynamically allocated symbols have a definite 
static scope, though this can be obscured when their scope is “extruded” (as 
they say in the pi calculus) to the outermost level.

Bob

(c) Robert Harper  All Rights Reserved.


> On Aug 1, 2020, at 11:54, [email protected] wrote:
> 
> [ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]
> 
> Michael Greenberg wrote:
>> 
>> I think "lexical" here (and in "lexical scoping") is meant to mean
>> "pertaining to the [bracketing structure of the] written concrete
>> syntax", even though that's not the dictionary meaning of the word
>> "lexical" (as you point out). It would make more sense to say
>> "syntactically enclosed", but... here we are.
> 
> Michael's reply prompted me to look up the actual dictionary meaning
> of the word "lexical", and I found two meanings (from
> Merriam-Webster). The first is:
> 
> 1. "of or relating to words or the vocabulary of a language as
> distinguished from its grammar and construction"
> 
> So that would be the meaning appropriate for phrases like "lexical
> analysis". But there's also:
> 
> 2. "of or relating to a lexicon or to lexicography"
> 
> That is the meaning I would associate with the phrase "lexical
> scoping". As I understand lexical scoping, a scope is a dictionary or
> lexicon, basically a map from identifiers of the concrete syntax to
> binding sites of the abstract syntax. This dictionary is updated
> during parsing. Perhaps "lexical" refers to the fact that the meaning
> of the identifier is looked up in this (static) lexicon, as opposed to
> determined dynamically at runtime?
> 
> -- Peter

Reply via email to