Syntax

    Based in Pascal, the syntax has nothing  someone might find strange (at least I think so). A class is shown below with comments between /* and  */ describing some important details. Everything after // till the end of the line is also a comment.

class Store
  public:    /* public section. Only methods are allowed */
      // method get returning an integer
    proc get() : integer
      begin
        // n is the method return value
      return n;
      end
    proc put( pn : integer )
      begin
      n = pn;
      end

  private:
      // declares an instance variable n
    var n : integer;
end
 

An object is allocated with new :

    s = Store.new();
    s.put(5);

Command if has the form

    if exp
    then
      commands
    else
      commands
    endif

in which the else part is optional. The endif keyword makes it impossible to associate the else with the wrong if in  nested if commands.

    There are commands for while, repeat-until, loop-end (endless loop finished by break), and for. These will not be discussed here although you can see some examples:

     for i = 1 to n do
       Out.writeln(i);

     i = 1;
     while i <= n do
       begin
       Out.writeln(i);
       ++i;
       end

     i = 1;   // considers n >= 1
     repeat
       Out.writeln(i);
       ++i;
     until i > n;

     i = 1;
     loop
       if i > n then break; endif
       Out.writeln(i);
       ++i;
     end
 
 

What is new ?

    Of course, nothing. No syntax can bring real improvements to a language although it should be noted the Green syntax is simple to understand.

Return