Programming Language for Old Timers


by David A. Moon
February 2006 .. September 2008

Comments and criticisms to dave underscore moon atsign alum dot mit dot edu.


Previous page   Table of Contents   Next page


Summary Of Built-Ins

This section is the equivalent of explaining all the constructs built into the compiler in other languages. But here these are simply definitions exported by the PLOT module. You can import them into your own module or not as you prefer. Most of these constructs have straightforward definitions within the language. A few of them involve intrinsic methods that are known to the compiler.

Standard operators:

+ addition, array concatenation
- subtraction
* multiplication
/ division
mod modulo
= equality
< less than
> greater than
<= less than or equal
>= greater than or equal
~= not equal
eq same object
~eq not same object
:= assignment
<< left shift
>> right shift
is instance of
: range given start and end
:+ range given start and length
& bitwise and
| bitwise or
~ bitwise complement
and logical and
or logical or
not logical not

Standard prefix macros:

( expression ) grouping
[ parameter-list => body ] function constructor
# data quoted data
` template ` token sequence constructor from template

Standard prefix macros considered statements: (explained below)

if test [then] body else body conditional (also allows elseif)
do body grouping
do body cleanup: body cleanup on exit
block body grouping and scoping
block exit: name body permit early exit
block body cleanup: body cleanup on exit
while test body iteration
until test body iteration
for ... body complex iteration
case .... case dispatch
with-slots .... abbreviated syntax for slot references
def variable or method definition
defoperator operator definition
defmacro macro definition
defparser parser definition
defsyntax parser definition, accepts already-parsed form
defmodule module definition
defclass class definition
defprotocol protocol definition
require method requirement

Standard infix macros:

function ( arguments ) call
collection [ subscripts ] subscripting
object . slot-name single-valued slot access
object . slot-name [ subscript ] multi-valued slot access
object . slot-name . length multi-valued slot length

Particles Used by Standard Macros:

, list element separator
=> input/output separator
\ denaturer, prevents next token from being special
# quote
= separates name and value
:= separates name and value, is assignable
? pattern/template variable
?: pattern/template variable, syntactic type same as name
?= bound particle in pattern, anaphoric name in template
{ } pattern grouping
[ ] pattern optional
^ pattern linebreak
~^ pattern not linebreak
| pattern alternative separator
& pattern suffix separator
{ }* pattern repeat zero or more times
{ }+ pattern repeat one or more times
[ ]* each alternative appears at most once, in any order
[ ]+ same but at least one alternative must appear
is type restriction (bound)
then
else
in
from
downfrom
above
below
by
while
until


Previous page   Table of Contents   Next page