% FILE. . . . . /home/hak/ngo/doc/hak/design/introduction.tex
% EDIT BY . . . Hassan Ait Kaci
% ON MACHINE. . Latitude314.Ilog.Fr
% STARTED ON. . Thu Jun  6 16:52:17 2002

% Last modified on Tue Jun 25 09:27:50 2002 by Hak

\chapter{Programming language design}

{\em Language} is a means of communication. By this definition, a
particular language serves as a conduit for information exchange between
communicating entities. Such entities may be of various kinds (be it
sentient---\eg, humans, animals---or pragmatic tools---\eg, elevators,
cars, computers,
\etc). A
{\em programming language} is a language for human-to-computer or
computer-to-computer communication.

A {\em natural language}, such as the one you are reading and I am
using right now, is a language for human-to-human communication. Such
languages are (generally) not designed---they
{\em evolve}.\footnote{In fact, natural languages---we do not include
here {\em artificial} human languages like {\em Esperanto},
\etc.---have {\em co}-evolved under one another's historical and
geographical influence and often mutate through exchange of syntax
and/or semantics. The ``damage'' incurred by a language adopting a new
often mutated concept from another being this co-evolution. There also
are some rare natural languages that evolved away from others for simple
geographical reasons.}{\em  Programming languages are designed.} They
are designed today more formally thanks to linguistic research that led
to syntactic science (leading to parser technology) and research in the
formal denotational semantics of programming constructs. As in the case
of a natural language, a grammar will regulate the formation of
sentences (programs) that will be understood (interpreted/executed)
according to the language's natural (denotational/operational)
semantics.

Designing a programming language is difficult because it requires being
aware of all the (overwhelmingly numerous) consequences of the slightest
design decision that may occur anytime during the lexical or syntactical
analyses, and the static or dynamic semantics phases. Because of the
potentially high design costs (in time and effort, but also in terms of
the quality of the end product---\viz, performance and reliability of
the language being designed)\footnote{Not to mention how to justify,
let alone guarantee, the correctness of the design's implementation.}
investing in defining and implementing a new language is prohibitive.

Fortunately, there have been design tools to help in the process.
So-called meta-compilers have been used to great benefit and higher
quality of language implementations. The ``meta'' part is actually
mostly true for the lexical and syntactic phases of the language
design. Even then, the metasyntactic tools are often restricted to
specific classes of grammars and/or parsing algorithms, and very few
propose tools for {\em abstract syntax}, and most that do confine the
abstract syntax language to some form of idiosyncratic representation of
a tree language with some {\em ad hoc} interpretation. Even less can
we find systems that propose abstract and reusable components in the
form of expressions of a formal typed kernel calculus. This is what this
work proposes and designs.

This work is therefore a metadesign: it is the design of a design tool.
The emphasis---the novelty of what is proposed here---is not so much on
the lexical/syntactical phases, but mostly on the semantic
phases.\footnote{The lexical/syntactic phases also deserve attention,
and I have implemented a set of extentions to the conventional
\txt{lex/yacc} (alternatively,
\txt{flex/bison}) meta[lex/syntact]ical tools~\cite{jacc}. More has to
be done on that side---\eg, documentation!---and much of it is
operational and can be used as a {\em de facto} [lex/syntact]ical
front end to the semantic architecture proposed here.}

This document describes the design of an abstract reusable programming
language architecture and its implementation in Java. It represents the
basis of the redesign of \ilog's New Generation \opl\ (hereafter
referred to as \ngo), and constitutes the second facet of a larger
soon-to-be proposed \ilog\ R\&D-wide project whose purpose would be to
enable the quick integration of new useful programming abstractions into
software at large,\footnote{\ilog's, for one, \textsl{intra-} and/or
\textsl{extra-} company\ldots} insofar as these abstract and reusable
constructs, and any well-typed compositions thereof, may be instantiated
in various modular language configurations.\footnote{The first facet was
the elaboration of \jacc, an advanced system for syntax-directed
compiler generation~\cite{jacc}. The third facet will be the integration
of logic-relational (from Logic Programming) and objet-relational (from
Database Programming). A later facet may be to complete the design to
enable both \life-technology~\cite{life} and \csp/\lp\ technology to
cohabit.}


