FOOL Free Object Oriented Language COOL Cool Object Oriented Language FOOL Functional & object oriented Language Basic Types void int8 uint8 int16 uint16 int32 uint32 int64 uint64 char cstr bool float, sfloat, lfloat byte,int,uint,short,ushort,long,ulong PROGRAM = INSTRUCTIONS INSTRUCTIONS = [INSTRUCTION|DEFINITION] ... INSTRUCTION = VOID_EXPRESSION ; FLOW_CONTROL { INSTRUCTIONS } NAMESPACE NAMESPACE = namespace [TYPE|NAME] { INSTRUCTIONS } // namespace, class or any type EXPRESSION = VALUE = VALUE SUFFIX PREFIX VALUE VALUE OPERATOR VALUE ( VALUE ) LITERAL // numeric, text, list, proc NAME // proc, const or variable NAME.NAME // same with namespace or object VALUE ( VALUES ) // proc. call VALUE [ VALUES ] // array item VALUE [ [VALUE] to [VALUE] ] // range of items in array LITERAL = NUMBER +123.456e-78 | 0x1234 | 'abcd' TEXT "abc" PROC TYPE ( ARGUMENTS ) { INSTRUCTIONS } TYPE = BASIC_TYPE_NAME DEFINED_ENUM_NAME DEFINED_CLASS_NAME DEFINED_ALIAS_NAME TYPE [ ] // array TYPE [ , ... ] // multi-dim array TYPE ( TYPE , ... ) // proc type DEFINITION = TYPE_DEFINITION CONST_DEFINITION VARIABLE_DEFINITION PROCEDURE_DEFINITION TYPEDEF = type NAME = TYPE; enum [TYPE] NAME = { ... } ; // define enum type (uint or as defined) and const values of that type enum NAME += { ... } ; // add some more const values for that enum type NAME = { [TYPEDEFS,VARDEFS,CONSTDEFS,PROCDEFS] } ; // class type NAME = TYPE + { ... } ; // subclass CONSTDEF = const [TYPE] NAME = VALUE ; const [TYPE] NAME = VALUE , ... ; VARDEF = TYPE NAME ; TYPE NAME = VALUE ; TYPE NAME , ... ; PROCDEF = TYPE NAME ( ARGUMENTS ) { INSTRUCTIONS } TYPE NAME ( this, ARGUMENTS ) { INSTRUCTIONS } // member function TYPE NAME ( this, ARGUMENTS ) virtual { INSTRUCTIONS } // virtual member function, tbd: all virtual? FLOW_CONTROL = IFELSE SWITCHCASE DOLOOP TRYCATCH RETURN [VALUE] ; BREAK ; NEXT ; WHILE VALUE ; IFELSE = if VALUE INSTRUCTION [elif VALUE INSTRUCTION] ... [else INSTRUCTION] SWITCHCASE = switch VALUE { [[case VALUE|default] : INSTRUCTIONS] ... } DOLOOP = do INSTRUCTION TRYCATCH = try INSTRUCTION catch ( ARGUMENT ) { INSTRUCTIONS } #################################### more #################################### call proc with return type: a = new Foo (42) ; list literal: a = Foo { x=22, y=33 } ; b = int[] { 1,2,3 } ; int[] b = { 1,2,3 } ; // maybe automatically deduced manual cast: a = (float) 42 ; call void proc: (alt. syntax: no brackets) print VALUE ; argument list extension: the return type must be void or the first argument type (of an overload): void print(cstr); // decl void print(int); // decl print "abc", 123, '\nl' ; // --> 3 calls int min(int,int); // decl a = min(a,b,c,d); // --> 3 calls templates: create a bunch of possible overloads which are instantiated on demand: void print(); opt: symbolic groups Numeric,Int,Float,SInt,UInt,Array