Treelang is a programming language created in 1988. Treelang is a "toy" programming language distributed with the GNU Compiler Collection (GCC) to demonstrate the features of its code-generation backend. It was developed by Tim Josling, based on a language called Toy created by Richard Kenner. During the GCC 4.3 release cycle, a patch was committed to remove the language, because of high maintenance costs outweighing its benefits and also because it was no longer considered a good front-end example by GCC developers.. Read more on Wikipedia...

32Years Old 20Users ?Jobs
  • the Treelang wikipedia page
  • Treelang first appeared in 1988
  • See also: c
  • Have a question about Treelang not answered here? Email me and let me know how I can help.

Example code from Wikipedia:

// function prototypes
     // function 'add' taking two ints and returning an int
     external_definition int add(int arg1, int arg2);
     external_definition int subtract(int arg3, int arg4);
     external_definition int first_nonzero(int arg5, int arg6);
     external_definition int double_plus_one(int arg7);
     external_definition int main();

     // function definition
       // return the sum of arg1 and arg2
       return arg1 + arg2;
       return arg3 - arg4;

       // aaa is a variable, of type integer and allocated at the start of the function
       automatic int aaa;
       // set aaa to the value returned from add, when passed arg7 and arg7 as the two parameters
       aaa=add(arg7, arg7);
       aaa=add(aaa, aaa);
       aaa=subtract(subtract(aaa, arg7), arg7) + 1;
       return aaa;
       // C-like if statement
       if (arg5)
           return arg5;
       return arg6;

     // Like C, 'gtreelang' needs the main to be defined to create an executable.
          return double_plus_one(5);

Last updated August 9th, 2020

Edit Treelang on GitHub