GOOD Generic Object Oriented Definitions

GOOD is a new Programming language under heavy development.

GOOD in a few words:

Foundation

/From C to GOOD

How does it look like?

Ok, here a small and in some detail incomplete overview about the core syntax.

core syntax

GOODs core knows only one construct, an 'object definition' which looks like: (/BNF page)

:name(parameters) base_object(arguments) { body }
  1. parameters, arguments and body are nested object definitions.
  2. base_object is the name of some other object.
  3. all of this entities are optional.
  4. GOOD supports multiple inheritance, thus there might be more than one base_object(arguments) statement.

  5. there might be more than one { body } part with baseclasses interweaved (not further explained here).

  6. All literals are string objects within the core syntax (this means that the program source consists of strings, and NOT that all internal data is handled as strings)
    1. String literals are enclosed in single or double quotes, note that this is only syntactic sugar to produce a string object.
    2. The name does not need to be enclosed in quotes if it does not contain whitespaces.

  7. Object definitions can be prefixed/postfixed/sequenced with operators. I won't explain that here because it looks straightforward. Assume arithmetic operators, ',' and ';' to be defined.
  8. A single underscore _ is used for universal pattern matching.

concrete examples:

an empty object named 'foo'

:foo;

an unnamed instance of 'exit'

exit;

an instance of 'integer' which is constructed with 10 and named 'ten'

:ten integer('10');

a "Hello World!" could look like this, but IO is still unspecified

print("Hello World");

a factorial implementation might look like this (flavored version with bounds check and exceptions)

:factorial( integer('0') ) function
{
  := integer('1')
},
:factorial( :n integer( _ ) { n > '0' && n <= '12' }) recursive function
{
  := { n * factorial( n - '1' ) }
},
:factorial( :n integer( _ ){ n > '12' } ) function
{
  := exception('out of range')
};

Semantics

Semantics will be described in the GOOD Book which i am working on. There is some discusion about it on /Semantics.

Operators

I put some prelimary thoughts about which operator will be used in GOOD on /Operators. Please review them and tell me if they are pleasant for our eyes.

Exceptions

I've written thoughts about the exception handling in /Exceptions

Imperative Programming library

Examples how /Imperative constructs can be implemented in GOOD.

GOOD (last edited 2008-08-06 05:27:00 by 212)