Treelang is a historical 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...

31Years Old 20Users 0Jobs
  • Treelang ranks in the top 50% of languages
  • the Treelang wikipedia page
  • Treelang first appeared in 1988
  • See also: c
  • I have 21 facts about Treelang. what would you like to know? 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
     add
     {
       // return the sum of arg1 and arg2
       return arg1 + arg2;
     }
  
     subtract
     {
       return arg3 - arg4;
     }

     double_plus_one
     {
       // 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;
     }
     
     first_nonzero
     {
       // C-like if statement
       if (arg5)
         {
           return arg5;
         }
       else
         {
         }
       return arg6;
     }

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

Last updated November 21st, 2019