1. Introduction

 

         The AC Language is a simple and flexible programming language created by Ahmed Chaari at the end of 2006. Although it has its roots in the C family language (C/C++, C# and Java), the AC Language is a completely dynamic and untyped language. AC language offers a complete platform for developing software solutions based on open AC architecture (OACA). This platform can manage in a transparent way to developers, the interoperability of different components of this architecture by implementing standard methods of communication. It also facilitates the deployment of developed solutions.  

         The graph below shows the overall architecture for AC applications :

 
Program structure:

           The main program structure for AC Language are entities, therefore AC Programs could be defined as a set of AC Entities. Each AC Entity is defined in a separate source file with ".ac" extension, and contains entity’s member declarations as following :

[using_entities] [entity_attributes] [entity_type] entity_name [entity_header] { [entity_member_1_dec] [entity_member_n_dec] }

          To define application’s hierarchy, AC entities are packaged into modules (each module contains one or more entities). Those modules are similar to executables and libraries in C  family languages. The deployment of AC solutions, and the communications between modules are based on the type of those module. The standard AC Platform provide the following types of modules :

  • Shared libraries (shrlib)
  • Dynamic libraries (dynlib)
  • Client executables (appexe)
  • Server executables (srvexe)
          The AC Language is based on Flexible Entities Concept, which allows the programmers to define their own Entity's compilation rules. When compiling AC Source Code, AC Compiler generate a pseudo-compiled files in the form of AC Entities Descriptor Language (ACEDL). When executing AC Progrrams, AC Entities Descriptor are converted (at run time) to executable Instructions, those instructions wille be executed by the AC Intructions Processor (ACIP):



         AC applications are divided into Modules witch define the application hierarchy. Each module is defined in a separate directory and contains one or more source files with .ac extension. An .ac source file contains only one entity declaration, and each entity is an ordered sequence of member's declaration as following:

Example :
library mathlib { function add(a,b) { return(a+b); } }
The generated ACEDL when compiling this code in a shared library "mathlib" is :
.module { .name = "mathlib"; .type = "shrlib"; .entity { .name = "mathlib"; .type = "library"; .member { .name = "add"; .type = "function"; .header { .name = "a"; .type = "param"; } .header { .name = "b"; .type = "param"; } .code { .g_fctarg 1 .g_fctarg 2 .e_add .e_ret } } } }
The generation of ACEDL is based on AC object descriptor defined as following :
object acobjdesc { string name; string type; acobjdesc[] header; acobjdesc[] member; acobjdesc[] attribute; acobjcode[] code; acobjvalue value; } object acentitydec : acobjdesc { aciddesc[] identity; acentdep[] external; } object acmoduldesc : acobjdesc { acmoduldep[] dependency; acentitydec[] entity; } object acobjvalue { union { char charvalue; int intvalue; double doublevalue; string stringvalue; string identvalue; } } object acobjcode { acoprid oprator; acobjvalue operand; }
Example 2 :
Window login_Window(resource="commenlib", panel="loginwin") { OnInitWindow { InitWindow(); } OnExitWindow { if (exitcode) { retvalue = username; } DisposeWindow(); } Field username textbox(string) { widgetname = "loginwin.username"; } Field passwd textbox(password) { widgetname = "loginwin.password"; editable = eval !is_empty(username); } Field okbut button { widgetname = "loginwin.username"; onclick { if(_validate_login_and_password(username, passwd)) { ExitWindow(true); } else { ErrorMessage("Invalid user/password"); username.setfocus(); } } } Field cancelbut button { widgetname = "loginwin.username"; onclick { ExitWindow(false); } } Function private _validate_login_and_password(username, passwd) { /* Put your validation code here */ return(true); } }

 

Types and variables:

         The AC Language is a non typed language, therefore an AC variables is declared as ACVariable (the base type for all AC language variables), and its types is determined only when affecting its value.

         In AC Language there are three kings of variable's types: error type, value types and object types. The error type is the primitive type for all uninitialized variables, value types describe all variables containing their data value, and object types define all variables containing data reference.

         AC value types are simple types such as: integral (int), floating point (double), characters (char), Boolean (bool), Enumerator (enum), date (date) and time (time). AC Object types are divided into string type, Class-Object types, Array types, delegates, events, callbacks ...

Make a free website with doomby.com - Report abuse