Erlang language issues

Richard Carlsson richardc@REDACTED
Wed Apr 17 14:34:14 CEST 2002

On Wed, 17 Apr 2002, Bengt Kleberg wrote:

> showing my ignorance i must at this point ask if there is a (simple)
> explanation for syntax vs semantics.

Syntax: how the text is allowed to "look".

Semantics: what sort of things/behaviour we are talking about

Erlang's syntax is described by the tokenisation and parsing grammars.
The semantics of Erlang programs is the visible behaviour and the data
objects being manipulated.

In the guards example, for instance, there are syntactic limits on how a
guard may look: only certain combinations of infix operators and
function calls, plus variables/constants. One can argue that any
expression should be allowed (syntactically) as a guard, and only if it
is semantically impossible - or at least not safe - should the compiler
reject the program: for instance if one of the called functions might
cause a side effect (perhaps indirectly). This would however require
extra analysis beyond simple syntax checking.


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW:
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham

More information about the erlang-questions mailing list