Subject: Research paper, English, cource C
Last edited: 25 May 1998
Author: Egil Möller
Green Mint
A cup of the future
Contents
1 Introduction
1.1 History
1.2 Introduction to object oriented programming (OOP)
1.2.1 Objects as boxes in boxes
1.2.2 Inheritance of functionality
2 The language
2.1 Objects under Green Mint
2.1.1 Objects as noun (Variables)
2.1.2 Objects as verbs (Methods)
2.1.2.1 The imperative form
2.1.2.2 Verb definitions using pronouns, adjectives and adverbs
2.1.2.3 Sentences returning a result
2.2 Built in objects
3 Finnish
1 Introduction
  A programming language is a constructed language, designed to instruct computers what to do. Such a language normally uses only the imperative form; write "Hello" on the screen, read the file "my text" from the hard disk, etc.
  A computer, in its native mode, understands only machine instructions, which are made up by series of numbers. These codes are very strange for a human being to understand. In order to simplify the programming of computers, several programming languages are created. These languages are then translated by a program called a compiler to machine instructions which can then be executed by the computer.
  The first programming language created was the assembly language. In assembly, each word (instruction), has its equivalent in the machine instruction stream generated by the compiler. Each sequence of numbers making up a machine instruction is represented by a "mnemonic", a short character combination which tells the programmer a little about what the command does. For example, the instruction mov instructs the computer to move a value from one place to another. After the introduction of the assembly language, several other languages have been created. Examples are C/C++, Pascal, Basic, Ada, Cobol, Java.
  Green Mint is the Esperanto of programming languages. It utilises features introduced in C++, Java and assembly. The main feature inherited from Java/C++ to Green Mint is the object oriented model, described later in this study. The goals for Green Mint are clearness, simplicity and smallness. What do these three words means? Smallness means the lack of a large set of instructions, words that the compiler (the program interpreting the language to machine instructions) understund. Simplicity means that the number of different forms (subject, predicate, accusative object) of a specific word are few. Clearness means that the language is easy to read, easy to understand.

1.1 History
  Spring -97 I was programming another language called Atlantis (with a second version called Late Atlantis). This language was built on some of the ideas on which Green Mint is now built. It was a simple and small language, but not clear. It was pretty hard to write anything in it, because of its huge use of square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square square brackets ([ and ]), braces ({ and }) and larger-/lesser- signs (< and >). A line could look like this:

_<
 _print[<:=true>|<:=<Hello world>>|<:=true>];
>[<:=true>|<:=hello>,<:=_input[<:=true>||<:=true>]>|<:=true>];

  Hard to read? Yes it was. And Atlantis was absolutely not intended for the beginner. Green Mint is much clearer to read. Here is an example of a line:

print `Hello world´ on screen

1.2 Introduction to object oriented programming (OOP)
  One of the main features inherited from C++/Java is the object oriented model. The basic element of this model is an object. An object can have different qualities and methods. When having a set of qualities, it works much like a noun. For example, an object house can have the qualities colour which is set to "red" and size which is set to "400m2". An object also can have a set of methods. The nearest equivalent in a human language to a method is a verb. A method is a word that, when used, instructs the computer to take action.

1.2.1 Objects as boxes in boxes
  Objects are structured as boxes in boxes. The object's methods and qualities are also objects, which can have methods and qualities, which can have methods and qualities, recursively. Let's have an other look at the house example. The house has the qualities wall, floor and roof. The quality wall is itself an object, which has the qualities window and door, the door then has the qualities doorknob and window (this door has got a window in it).

1.2.2 Inheritance of functionality
  Objects can inherit functionality from each other. This means that when creating a new object, copies of all sub objects (qualities and methods) of another object are created. These copies can then be replaced or complemented with other qualities and methods, local to the object being created.

2 The language
2.1 Objects under Green Mint
  A Green Mint program is itself, as a whole program, an object. New sub objects can, and must be added in order to create a functional program. Each sub object, and subsequent sub objects are defined (created) with the line
objectName inheritObject1 inheritObject2 … inheritObjectN.
  In this line, the objectName is the name of the object to define. inheritObjectX are objects, from which the current object are inheriting sub objects. These objects can either be objects already defined, or direct definitions of sub objects to be included in the object to define. Such a list of sub objects is enclosed by braces ({ and }). Each sub object is then defined in the same manner, inside the braces. Note that there is no need to define any sub objects, any objects to inherit from, i.e. it is totally legal to define an object just with its name and then an end-of-line mark, a dot (.).
Example, identical to the previous one
house
 {
  wall
   {
    window.
    door
     {
      window.
      doorknob.
     }.
   }.
  floor.
  roof.
 }.

2.1.1 Objects as noun (Variables)
  An object in Green Mint may be either a variable, a noun, or a verb (function), or just a container of sub objects, or a combination of the latter and one of the other two "modes". As a noun, an object may contain a list of values and/or text strings (characters, words, sentences, paragraphs or even whole books). When an object inherits from another object, the value(s) of the other object is/are added to the object being defined. Opposite to sub objects, values are never replaced during inheritance. When defining an object as a noun, each word to the right of the objectName can be either an object to inherit from, or a value. If the value is a text string, it must be surrounded by ` and ´.
Extended example with the house object:
house
 `My little sweet house´
 {
  colour `red´.
  owner `not very rich´ `Mc Douglas´
  wall
   {
    colour `green´.
    window.
    Door
     {
      window.
      doorknob.
     }.
   }.
  floor.
  roof.
 }.

2.1.2 Objects as verbs (Methods)
  Objects can also be used as verbs (methods). A verb is defined as an explanation of the verb. Lets take an example from real life; the word run, which may be defined as "lift left leg, put it down a little bit forward, lift right leg, put it down a little bit forward. Repeat as long as running, and do this pretty quick.".
  An object is defined as a verb, if at least one of the objects from which it inherits is a verb. A direct declaration of sub objects (a list of sub objects surrounded by braces) is a verb, if it contains not only sub object declarations, but sentences in imperative form.

2.1.2.1 The imperative form
  A sentence is made up by predicates and subjects. A predicate is either a verb, or one of the predefined verbs. The predicate defines what will happen to the subject, e.g. the subject may be destroyed, copied, assigned a new value, or a sub object may be added to the object. The form of a sentence is

predicate subject1 subject2 … subjectN.

  Subjects may be separated by prepositions and adjectives. A preposition defines the relation between the different subjects and an adjective defines the subject in more detail. If more than one preposition/adjective are used, the prepositions/adjectives must be separated by the word AND. If both adjectives and prepositions are used, the adjectives must be placed last, directly before the subject. There should not be any word between the prepositions and adjectives. The sentence may be followed by one or more adverb(s), which specify the predicate closer. If more than one adverb is used, they must be separated by the word AND. Subjects may either be just nouns, or they can be sub sentences.
  A sub sentence is a sentence surrounded by brackets which may be used as a subject in another sentence. Each time the predicate in the main sentence attempts to use the subject, the sub-sentence is executed, and the result of it is used as substitute for the subject. A result is a value, or an object, that the predicate creates from the information of the subject(s), adjective(s), preposition(s) and adverb(s).
  But, doesn’t this form interfere with the object definitions? Yes, it is similar. But, in a sentence, the first word, the predicate, is always either a predefined verb, or a verb already defined as an object. Also all subjects must be either values, or defined objects. Prepositions, adjectives and adverbs may not be defined objects.
  The final form of a sentence, including subject(s), predicate, and optional preposition(s), adjective(s) and adverb(s) is (words surrounded by square square square square square square square square square square square square square square square square square square square square square square brackets ([ and ]) are optional):

predicate [[preposition1 [… AND prepositionN]] [adjective1 [… AND adjectiveN]] subject1 […[[preposition1 [… AND prepositionN]] [adjective1 [… AND adjectiveN]] subjectN]] [adverb1 [… AND adverbN]].

Example sentence:

Example verb definition

2.1.2.2 Verb definitions using pronouns, adjectives and adverbs
  The words supplied in the sentence after the predicate, except the adverbs, are sent to the predicate as one object with sub objects for each word. This structure is called parameters.
Format of the parameters object
  The adverbs are not sent to the predicate, since they define changes to the predicate and its behaviour. They are instead interpreted as a sub object "mask", which select a sub object to the verb, which must be defined as a verb, to use instead of the verb. If several adverbs are used, the first selects one sub object to the verb, and the next selects a sub object to the sub object, and so on, recursively.
  Adverbs supplied in a sentence are not order significant, i.e. they may be reordered in the sentence from the order in which the sub objects and sub objects to the sub objects are defined inside each other. The Green Mint interpreter will always reorder the adverbs, so that they match a list of sub objects and sub-sub objects if possible (i.e. if there is any list corresponding to the list of adverbs, in any order). Though, there is no need to define the same list of object, sub object, sub-sub object several times, in different order.
Example of adverbs using sub objects to the verb

2.1.2.3 Sentences returning a result
  A sentence may return a result (see "The imperative form" for more information on using the result). This result is, upon termination of the predicate, copied from a special object named "result", if existing, which the predicate has the responsibility to create and assign a value.

2.2 Built in objects
  Every verb defined in Green Mint is explained by a list of sentences containing other verbs. To start with, there is a list of verbs which doesn’t need to be defined. These verbs are so-called pre-defined verbs. These verbs may be used in the same manner as normal verbs to perform special actions. Additional to this set of pre-defined verbs, each implementation of the interpreter can include its own set of pre-defined verbs.
Predefined verbs
Verb Subjects/adjectives/pronouns Explanation/usage
Do DO object IF condition
DO object WHILE condition
DO object UNTIL condition
Executes the subject condition. If the result is a value larger than or equal to 0 and the pronoun while or if is used, or the result is lesser than 0 and the pronoun until is used, the subject object is executed. Then the subject condition is re-executed and the procedure is redone again and again, unless the pronoun if is used, until the result of condition is a value lesser than 0 if the pronoun while is used, and equal to or larger than 0 if the pronoun until is used.
Returns: Result from last execution of object.
Delete DELETE object Deletes the specified object.
Returns: 0 if object existed, otherwise -1.
Make MAKE LINK object1 TO object2
MAKE COPY object1 OF object2
Turns object1 into a link to or copy of object2. When creating a copy, all sub objects to object2 are also copied to sub objects to object1.
Returns: 0 if object2 exists, otherwise -1.
Insert INSERT name IN object Creates a new object with the name name as a sub object to object.
Returns: Undefined.
Not NOT value Returns 0 if the value is lesser than 0, and -1 if the result is equal to or larger than 0 as result.
Add ADD value1 AND value2 Returns the value of value1 plus value2 as result.
Subtract SUBTRACT value1 from value2 Returns the value of value2 minus value1.
Multiply MULTIPLY value1 AND value2 Returns the value of value1 multiplied with value2.
Divide DIVIDE value1 WITH value2 Returns the value of value1 divided with value2.

Additional common optional predefined verbs
Verb Subjects/adjectives/pronouns Explanation/uaseg
Print PRINT value ON object Concatenates the text string value of object with the value value. Intended to print values on a screen object.

Returns: 0 if object object exists, otherwise -1.

Read READ object Returns the first line of text from the value of object and removes the returned line. If object does not exist, an empty string is returned.

3 Finish
  Is this language really useful? To answer this question, we must look at possible usage domains. This language has a lot in common with human languages, and is therefore a good choice for a poweruser. Powerusers don’t program real applications, but small macros, customising their computer and its behaviour. Green Mint may, with its easy way to interface the user, be used as both a macro language, and as a direct command interpreter (CLI), which may be used instead of the normal DOS or *N*X-prompt.