EnglishРусский  
The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

Gentee overview

Introduction

The Gentee programming language can be classified as a procedure-oriented language with some features typical of object-oriented programming. It has no complicated constructions and is easy to use, but at the same time it is a powerful tool for solving all kinds of tasks. The syntax of the language is based on the syntax of the C programming language and it has a lot in common with other C-like languages C++, Java, C#. Gentee has the same numeric types int, uint, byte, ubyte, long, double, float, ... and can perform the same operations with them +, ==, <, >, -, /, +=, ++, --, /=,... as in other similar programming languages. When you write programs, you can use all basic constructions that you come across in other languages. For instance, such as while, if, for, with, foreach, switch, include .

The compilation unit in Gentee is a declaration command. Below you can see the sample declarations of global variables and macros.

global
{
   uint  i my = 0xFF
   str   name = "Alexey"
   arrstr colour = %{"red", "green", "blue" }
}

define 
{
   PATH = $"c:\temp\docs"
   FLAG = 0x0001
}

While it is enough to specify the name and parameters ( in case of a function ) in order to access a variable or call a function, you have to add '$' to the left in order to substitute a macro. The values of macros are substituted during compilation.

i = my | $FLAG

Types

Besides basic numeric and built-in types buf, str, collection, it is possible to declare your own types using the type command.

type mytype_a
{
   uint id
   str  name
}

Variables of any type do not require additional initialization after their declaration, you can access them at once. Type fields are accessed with the help of the '.' operation. Types can be inherited (the same as in object-oriented languages) and the polymorphism of operations is provided for. If there is no method or function for some variable of a certain type, similar methods for its parent types will be searched for. It is possible to define and use operations used for numeric types ( =, +=, ==, != ) and the foreach loop for any types.

type mytype_b<inherit = mytype_a> : double d

operator mytype_b =( mytype_b left, mytype_a right )
{
   left.id = right.id
   left.name = right.name
   return left
}

Functions

Gentee has three kinds of commands for determining the executable code: func, method, operator. The program is executed starting from the function that has the main attribute.

func - A regular function responsible for performing operations specified in it.

func hello< main >
{
   print("Hello, World!")
   getch()
}

method - A function linked to a certain type. Calling a method is similar to taking a field of a type and is performed with '.' with the name and parameters of the method following it.

method uint str.islastchar( uint ch )
{
   return this[ *this - 1 ] == ch
}

func myfunc
{
   str my = "String"
   print( my.islastchar( 'g' ))
}

operator - This command allows you to define assignment, comparison, arithmetical and other operators and use them later for any types.

operator str +=( str left, uint i )
{
   return left += str( i ) 
}

func myfunc : print( "Value = " += 100 )

Gentee is a strongly-typed language. It imposes certain limitations on programming, but it considerably reduces the possibility of mistakes on the other hand. Several functions and methods with the same names can exist, but they must have at least one different parameter or a different number of parameters.

Strings

Gentee has wide capabilities regarding working with strings. Strings are defined with the help of double quotation marks and have the control character '\'. If a string begins with '$', it will not take the control character into account. Besides inserting special characters, the control character allows you to insert data from files, calculate and insert expressions inside a string and also insert macros.

print( "Name = \( name += " gentee" ) Path = \$PATH\n")

It is often necessary to output some large amounts of text and part of this text is to be generated dynamically. It is convenient to use text functions in this case. They can output data to the string you specified while calling them or to the console.

text mytext( uint x )
Some text 
x = \( x )
x * x = \( x*x )
\{ uint i
   fornum i, 5
   {
      @"x * \( i ) = \( x * i )\l"
   }
}
Some text
\!

Importing functions and using Gentee in other applications

From the very beginning Gentee has been developed in such a way that it would be possible to import functions from DLL (or similar modules in other operating systems) on the one hand and that it would be possible to use the Gentee compiler from programs written in other programming languages on the other hand.

If you need to import functions from a DLL, just specify the name of the DLL file and declare the imported functions.

import "kernel32.dll" {
   uint CloseHandle( uint )
        ExitProcess( uint )
   uint GetModuleFileNameA( uint, uint, uint ) -> GetModuleFileName
}

If you want to compile files in the Gentee language and execute them from your application, just take the file gentee.dll and call the necessary interface functions. You can use the module gentee.dll free of charge, but you must comply with the license agreement.

Conclusion

Here are a few words about how the compiler works. The source code of the compiler in the C programming language is publicly available since Gentee is an open source project. The compilation rate is very high. As a result of compiling a program, you get a byte code that can be saved to a file or executed at once. It is possible to run the saved byte code without the second compilation or use it as a library module in other programs. Note that there is a set of ready libraries available and it is being constantly updated, which helps to create programs of any complexity. Besides, it is possible to create executable ( exe ) files.

We have described only the main things typical of the Gentee programming language. You can always find additional information on this site and discuss any questions with the developers and other users of Gentee.