picture of cup of coffee, courtesy of Wikipedia   Decaf—Java without the jitters™ © 2008, Martin Rinehart coffee canisters, courtesy of Flying Bean
Why Decaf? Because beginners need a language, too.
Format:
statement
statement
statement ...
Alternate format:
long statement that;
continues on next line
Decaf is strictly left-to-right except as modified by parentheses.
1 + 2 * 3 is 9, because (1 + 2) * 3 is 9. For 7, use 1 + (2 * 3).
(-1)ABS => x ("-1 is passed to ()ABS; ()ABS's result is assigned to x.")
Why? Precedence Directionality
43 Reserved words:
AND
BIT BREAK BYTE
CANDO CAPABILITY CHAR CLASS
DEC DO
E EACH ELSE EQ EXTENDS
FALSE FOR
GE GLOBAL GROUP GT
IF IN INCLUDE INT
LE LOCAL LOOP LT
ME
NAMELIST NE NOT
OR
PI
RETURN RO RW
SUB
THEN TRUE TYPE
WHILE
  Decaf design goals:
  easy to learn
easy to teach
good for scripting
  For pros, this page is all you need.
Designed by a backpacker:
"When in doubt, leave it out."
Decaf is strongly typed, but types may be declared implicitly. 3 => x; "Nancy" => y . (Same as 3 => INT x; "Nancy" => [5]CHAR y). Compile-time error: IF cond 3 => x ELSE "three" => x . Arithmetic:
+ - * /
^ (exponentiate)
% (modulo)
Assignment: =>
Comparison:
GE GT EQ
LT LE NE
Data types: Every class name plus BIT, BYTE, CHAR, INT, DEC, GROUP, NAMELIST, TYPE, SUB
Decaf is case sensitive. All decaf words are UPPERCASE. Recommend mixed case and lowercase for other words. Decaf's editor will capitalize reserved words. Logical:
AND OR NOT IN
uses short-circuit eval
Bitwise:
handled by BITARRAYs
[] subscript
. lib,object access
, group/list separator
() order specifier
: integer array creator
Numbers—BIT, BYTE, CHAR, INT, DEC, TYPE—are passed by value. All others are passed by reference. [100]INT x //error
specify explicit start
[1:100]INT x
Decaf names are one alpha followed by zero or more alphanumeric and underscore characters. Predefined constants: TRUE, FALSE, E, PI
Variables are single (scalar), a value or a reference to a list (1D array), to an array (2+D) or to other data structures. Comments "here to EOL" start "//"
Block comments use multiple EOL comments
Multi-line strings ''' (multiple lines) '''
In arrays, the rightmost subscript varies most often. A 4x3 array may be used as a 12-item list.
Each compilation unit is a block statement. LOCAL variables (default) are visible within the block in which they are declared. GLOBAL variables are visible until they go out of scope. Declaration of a second variable with an already visible name is an error. All variables go out of scope at the close of the block within which they are declared. INT:0 1 -4 -3E6 0xd[d]...
DEC:.5 -3.E6 3E-6 50%
BYTE:"x" 'x' "\xnn"
[]CHAR:"Don't" 'Don''t'
GROUP: (1, "Fred", 0.5)
NAMELIST: Sunday, Monday, ...
TYPE: INT, ANGLE, ...
SUB: ()ABS
\r=return \t=tab
\', \", \\ = themselves
\xnn=hex nn, \xnnnn=hex char
Functions (subs that return a value) may not modify global variables. Sub's signature is argument types, name and return type(s). LOCAL subs and classes are visible within their own compilation units. GLOBAL subs and classes are visible to any unit that INCLUDES the sub's compilation unit. Decaf console (like unix shell) provides simple I/O. Learners test expressions. Ask "2+2?" and it prints "4". With program at break point, ask "foo?" and it prints "DEC = 14.7" or whatever. 1:6 => ;
  [1:2, 1:3] a

a 1 2 3
4 5 6
[ ,2:3]a 2 3
5 6
A class's name is its type. OBJECT is the (in)direct parent of all classes. Classes have an implicit constructor of one statement: RETURN ME. Explicit constructor for class Foo: ([args]) [scope] Foo action_statement. Within the constructor, ME is a reference to the object being created. Destruction is handled automatically. Objects are created by assignment: ([args])ClassName => object_ref_name. Object data may be GLOBAL (read/write) or LOCAL (read-only). Assignment to LOCAL from outside class is a compile-time error. Use of xxx.object is a call to get_xxx.object, if coded. Assignment to xxx.object is a call to set_xxx.object, if coded. "ERRORS" is a GLOBAL STACK of ERROR objects. At a programmable size (default is 2), ERRORS is written to console and program terminates.
Qualified names: 'foo.bar' searched only in given class (back up inheritance chain, if needed) or module Unqualified names: 'bar' in local routine, class (if any), current module, then through includes in order included Note: this is compile time, not run time. Everything in Decaf, including names, is a first-class object. GUI event handling: shamelessly steal from Javascript. It's wonderfully simple. (Can a robust widget set, like wx, be covered within Javascript-equivalent syntax?)
4 Declaration Statements:
Syntax of the Syntax

[scope] [access] [rangespecs] type
varname
      
::> rhs ::>
decl_stmt

LOCAL | GLOBAL ::> scope
< Decaf data type or object type > ::> type
('type' may be omitted when rhs is part of an assignment statement)
'['rangespec[, rangespec]*']' ::> rangespecs
start:end ::> rangespec
RW|RO ::> access
INCLUDE address[, address]* ::> include_stmt compilation unit(s) to include
{CLASS | CAPABILITY} name
[EXTENDS parent]
[CANDO capabilities] [''' doc comment '''] action_statement ::>
type_stmt
begins class definition
capability[, capability]* ::> capabilities
SUB (args list) [scope]  subname ([return types list]) [''' doc comment '''] action_statement ::> sub_stmt inputs on left, outputs on right
type[, type]* ::> types list
8 Action Statements
expr_group ['=>' rcvr_group] ::> expr_stmt expr[, expr]* ::> expr_group
rhs[, rhs]* ::> rcvr_group
( rhs is defined, first declaration statement )
( expr1 must evaluate to type of rhs1, ...)
( rhs undeclared? rhs's type becomes type of expr )
( unassigned values are output to console )
INDENT [''' comment(s) '''] statement* UNINDENT ::> block_stmt Note
IF cond THEN action_statement
[ELSE action_statement] ::>
if_stmt
Note 1
FOR EACH varname IN list DO action_statement ::> foreach_stmt list may be array, list or group
WHILE cond DO action_statement ::> while_stmt
LOOP ::> loop_stmt completes loop block, continues loop
BREAK ::> break_stmt completes loop block, terminates loop
RETURN [expression list] ::> return_stmt number and type(s) of returns must match declaration
¹ By its definition, an IF statement can expand to:
IF cond1 THEN act1 [ELSE IF cond2 THEN act2]... ELSE actN
ELSE binds with nearest unbound IF.
Decaf Object Library

Partial list follows. More to do.

Built-In Functions
 

Console I/O Functions

INPUT => GROUP gets value(s) from console
expr[, expr]... PRINT writes to console
 

Mathematical Functions

(INT | DEC )ABS => INT | DEC absolute value
(list)AVG => GROUP returns (mean, median, mode)
(list) MEAN => INT | DEC DEC for DEC list, INT for all others
MEDIAN => INT | DEC DEC for DEC list, INT for all others
(list)MODE => INT | DEC DEC for DEC list, INT for all others
(numeric list) PRODUCT => INT | DEC similar to ()SUM, but multiply instead of add
result is DEC for DEC list, INT for all others
(list)STDDEV => DEC standard deviation
(numeric list)SUM=> INT | DEC result is DEC for DEC list, INT for all others

Array Methods
(item, INT where)INSERT.arr inserts item[s] into arr starting at "where"
(INT where, INT num)READ.arr => []TYPE returns copy of first or last element[s] of array
(INT where, INT num)REMOVE.arr => arr removes and returns num element[s] from arr starting at where
([,dimension])SORT.arr sorts array in place by first [or specified] dimension
In above, "where" = 1 means first element; "where" = -1 means last element
(-1, 3)READ.arr => arr[end-2], arr[end-1], arr[end]


Other Functions

(INT)BYTE => BYTE (13)BYTE => '\r'
(INT)CHAR => CHAR create CHAR given it's numeric value
(TYPE a, TYPE b)COMPARE -1, a LT b; 0, a EQ b; 1, a GT b
(BYTE|CHAR)INT => INT integer value of a byte or char
({TYPE, TYPE}|arr)MAX => TYPE maximum—handles same-type COMPARABLEs or any numerics
({TYPE, TYPE}|arr)MIN => TYPE minimum—handles same-type COMPARABLEs or any numerics

coffee canister, courtesy of Flying Bean Decaf—Java without the jitters™ single coffee bean, courtesy of Caribou Coffee