Level 3 - The 4gl -

 

 Enduser4gl Web site
Bergougnoux Consulting
Enduser4gl Project
EndUser4gl Objectives
Enduser4gl  Presentation
Level 1 - The EndUser4gl -
Level 2 - Les User4gl -
Level 3 - The 4gl -
EndUser4gl Applications Download
EndUser4gl Sponsor
EndUser4gl Research
EndUser4gl  Licence
EndUser4gl FAQ
EndUser4gl Participation

   

 

Publish EndUser4gl

 

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

 

 

 

Level 4gl : Page 2   >   Level 4gl : Page 3

  


 

 

Open Source EndUser4GL : Detail of programms:

See the project : EndUser4gl.DSW (Visual C++ 6.0)

Folder : C:\EndUser4gl\4gl\bin\OpenSource\EndUser4gl

old folder : C:\EndUser4gl\4gl\bin\User4gl\EndUser4gl

 

 All the source programs are delivered with the product   . C:\EndUser4gl\4gl\bin

 

 Open Source EndUser4GL : step of implementation(summarize)

 

The EndUser4gl language was conceived with  Microsoft Visual C++ 6.0 compiler.  

This language design challenges traditional knowledge on compilers theory,

tokens, lexemes, parsers, aso...

I will try and summarize you in a simple way the construction of this  compiler.  

What you need to know for this construction:  

  

 

° To define Tokens that initiate the syntactic rule.  This  one identifies a syntax based on instructions or key

words, and after each instruction or key word, the only thing left is to develop the desired action:  

These are the executions codes

 

Example :   A grammatical syntax:  subject verb complement

I sing false  .

  I tell a history.  he sings.  

becomes with the EndUser4gl compiler:  

MAIN  :   T_SUBJECT T_VERB T_COMPLEMENT M_P ;

T_SUBJECT :    

                 M_I   

        |       M_YOU    

        |       M_HE     ;

T_VERB :       M_SING  

        |       M_TELLE   ;

T_COMPLEMENT :  M_ARTICLE M_STORY { Action 2 }

        |       M_FALSE  { Action 1 }

        |        ;

 

#TOKEN        MAIN

#TOKEN        T_PHRASE

#TOKEN        T_SUBJECT

#TOKEN        T_VERB

#TOKEN        T_COMPLEMENT

** lexicaux

#DEFINE-LEX            L_NAME_SUJET               ALNUM

#DEFINE-LEX            L_NAME_VERBE              ALNUM

#DEFINE-LEX            L_NAME_COMPLEMENT   ALNUM

#DEFINE-LEX             L_NUM                            FLOAT

#DEFINE-LEX             L_INT                            INTEGER

#DEFINE-LEX             L_LONG                  LONG

#DEFINE-LEX             L_STRING                 STRING

#DEFINE-LEX             L_MOT                    MOT

 

* sysnopsis de mots-cles : #DEFINE-MCLE     M_xxxx     constante

* EndUser4gl  Copyright 2001

 

#DEFINE-MCLE           M_P            .

#DEFINE-MCLE           M_I           I

#DEFINE-MCLE           M_YOU      YOU

#DEFINE-MCLE           M_HE       HE

#DEFINE-MCLE           M_SING      SING

#DEFINE-MCLE           M_FALSE    FALSE

#DEFINE-MCLE           M_ARTICLE     A

#DEFINE-MCLE           M_STORY    STORY

#DEFINE-MCLE           M_RACONTE     TELL

 

#DEFINE-CHAR-SPEC         .

 

 Liste de la compilation Enduser4gl : List programs of interpreter

Liste de la compilation EndUser4gl : Tokens

Liste de la compilation EndUser4gl : Key Words

Liste de la compilation EndUser4gl : Lexicaux

Liste de la compilation EndUser4gl : Syntactics Rules

Liste de la compilation EndUser4gl : Relation block and special characters

Liste de la compilation EndUser4gl : Executions codes

Liste de la compilation EndUser4gl :  interpretor's codes execution

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 Level 3:  Specialists 4gl: Implementation

 

general rules :

 

*  * BEGINNING OF THE RULES : MAIN : is obligatory

* *  Informal conventions:   :

*                         T_ :  TOKENS

*                          M_ :  KEY WORD

*                           I_ :   INSTRUCTIONS

*                          L_ : the variables (integer,long,doubles, strings etc

which will be   piled up

*       |       OR

*       | ;    ANYTHING, i.e. no obligation to find

* a word cles, instructions, a variable

*       | xxxxxx ;      obligation to find and an eventuel end of rule

* Tokens are always followed of ": "  and express the rules  to be followed.  

* and their termination is the ;  

 

*  Token :          

                  #TOKEN   <token name>

Example :"#TOKEN        T_DIVISIONS"

Attention  token "MAIN " is obligatory at the BEGINNING OF THE RULES

*  The instructions:

#DEFINE-INST  <identifying for the rule >   followed < language key word > .

Example : "#DEFINE-INST          I_SUP               >           ",

 

*  Key word :

#DEFINE-MCLE  identifying for the rule >   followed language key word >>

Example :"#DEFINE-MCLE           M_GETSELECTLISTBOX          GETSELECTLISTBOX"

 

*  Syntactics rules :

Start with beginning by a TOKEN and 2 small points ": "  Identifier of

the instruction or key words (max 30 bus).  Each rule can contain 35  

cells maximum(inst or key words  + code exe).  To employ | expressing  it there

condition OR.  Each rule owes termeiner by a point comma;

example :

" T_INSTRUCTION :    ",

"                 T_DECLARE_PROCFUNC   ",

"               |  M_BEGIN  T_INST_LIST M_ENDBEGIN    ",

"               |  M_RETURN   T_INSTRUCTRETURN { CodeExeReturn }",

"               |  T_AFFECT_ALPHA   ",

"               |  T_AFFECT_NUM    { CodeExeTabSymUpdate }",

"               |  M_DISPLAY  ;    ",

 

 

*   Execution Codes: { Identifier of the Code (30 bus max) }   foot-note if  you

have several   execution codes for an instruction, you must put each  

code execution on a separate line.  

 

Examples

DEPILATE

Depilate   Alnum:    OPCF_Pile_Depile(P_STRING, (void *)&(char[] ));

Depilate   String :    OPCF_Pile_Depile(P_STRING, (void *)&(char []l) );

Depilate   Long :    OPCF_Pile_Depile(P_INTEGER, (void *)&(long) );

Depilate   Double  :  OPCF_Pile_Depile(P_INTEGER, (void *)&(double) );

Depilate  Float     :   OPCF_Pile_Depile(P_INTEGER, (void *)&(float));

Depilate   Integer   :  OPCF_Pile_Depile(P_INTEGER, (void *)&(int) );

Examples

 EXECUTION

CODES

 Announce:

calcul.cpp : ordinary calculator

if.cpp

move.cpp

sql.cpp

   Offered in the event of acquisition of a licence:  SQL.CPP

SUMMARY :

* create your token : EndUSerCompil.cpp

* create your instructions and or key word :EndUsercompil.cpp

* create syntactic rules : EndUsercompil.cpp

* create your execution codes :EndUsercompil.cpp + opccodex.h

+ your program c/cpp : To create the function which will be called by

EXECUTE.CPP

* To add in EXECUTE.CPP your execution code while adding to it  the

function above created

 

IMPLEMENTATION

 

Example :

1) Example  : Your instruction :

                 Hello "Windows" ou Hello "xxxxxx"

** *************

** TOKENS

** *************

#TOKEN T_HELLO

** ***********

** KEYWORD   

** **********

##DEFINE-MCLE M_HELLO    HELLO

** ********************

* lexicaux

** ********************

#DEFINE-LEX            L_STRING   STRING

** *************

** RULES/REGLE

** *************

MAIN :  T_HELLO ;

 

T_HELLO : M_HELLO L_STRING { CodeExeHello } ;

** ************

** Code exe :  opccodex .h

** ************

 #define CodeExeHello 200   <........

 EXECUTE.CPP :

 #include "opccodex.h" .............

Class EndUserApp :: Cwnd

{....

long OPCExecute_user(long );

...

long FunctionTOTO(long)

}

extern long

EndUserApp::OPCExecute_user(long OPCcodeExe

) /* IT IS THE STANDARD FUNCTION OF ENDUSER4GLCOMPILER

 

{

    if((  OPCcodeExe== 200)    )

                 return FunctionTOTO(OPCcodeExe)  ;    

}

*************************************************Fin de Execute.cpp

 *************************************************

     Programme : toto.cpp             

*************************************************

long EndUserApp:FunctionTOTO(long codeexe)

{  .char value[255];

  char name[60];

 if( OPCcodeExe == 200 )   

        {   

                     OPCF_Pile_Depile(P_NAMEVAR, (void *)name );

                OPCF_Pile_Depile(P_STRING, (void *)value );

                printf("%s" ,value);

         }

 ** **********************************************

**      R E SU ME

** *********************************************

STructure Compilateur :

 

1) Call/Appel du compilateur/interpreteur :ENDUSER4GL.CPP: EndUSerApp::InitInstance()

{...

         EndUser4glInterpLib(m_hInstance,m_hPrevInstance,pszLine2+1 ,NULL);

}

-- > return (long code execution)

 2) Point entrance  (long Code) :  

         long EendsSer4glApp::OPCExecute_user(long OPCcodeExe)

 3) Execution of the function represented by specialist  :  

                                function ...EndUserApp::xxxxxx

 


 

ENDUSER4GL OPEN SOURCE VISUAL C++ 60   June 2004

 Resume :

 

**STEP 1 * INVENTE / MAKE : INSTRUCTIONS

1) Example : (into hello.4glExe with notepad, write, editenduser4gl

 

Hello "Windows"

** ///////////////////////////////////////////////////END STEP 1

 

 

**STEP 2 UPDATE / MISE A JOUR :ENDUSER4COMPIL.CPP

** *************

** 1 TOKENS :

** *************

#TOKEN T_HELLO

** ***********

** 2 KEYWORD/MOT CLE

** **********

#DEFINE-MCLE M_HELLO HELLO

** ********************

* 3 lexicaux

** ********************

#DEFINE-LEX L_STRING STRING

** *************

** 4 RULES/REGLE + CODE EXECUTION

** *************

MAIN : T_HELLO ;

T_HELLO : M_HELLO L_STRING { CodeExeHello } ;

 

** ************

** 5 Code exe :

** ************

"#define CodeExeHello 60120 ", <........

** /////////////////////////////ENDUSERCOMPIL.CPP//////END STEP 2

 

 

**STEP 3 UPDATE / MISE A JOUR :ENDUSER4GL.H

** ADD Function : endUser4gl.h

** long ExeHello(long)

.

class EndUser4glApp : public CWinApp

{

public:

EndUser4glApp(LPCTSTR lpszAppName);

//{{AFX_VIRTUAL(EndUser4glApp)

public:

..........

int EndUser4glInterpLib( HINSTANCE hInstance,HINSTANCE hPrevInstance,

LPSTR lpszCmdLine, int nCmdShow);

....

protected:

long OPCExecute_DemoEndUser4gl(long OPCcodeExe) ;

long OPCExecute_SynWinScreen(long);

.......long ExeHello(long);

//}}AFX_VIRTUAL

DECLARE_MESSAGE_MAP()

 

}; .

** /////////////////////////////ENDUSER4GL.H//////END STEP 3

 

 

 

**STEP 4  CREATE / CREER :

** your Programm/votre programme : toto.cpp ou exePdf.cpp

  .

long EndUser4glApp::long ExeHello(long OPCcodeExe)

{ char zone1[C_CMP_TAILLE_NOM_DICT] = "\0";

char valeur1 [MAXBUFLENSTRING] = "\0";

switch(OPCcodeExe)

{

case CodeExeHello:

 

OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1); /* attn : ***NULL*/

OPCF_Pile_Depile( P_STRING, (void *)valeur1) ;

printf("%s",valeur1);

OPC_Depile_All();

 

break;

......

}

ADD your/votre programm in enduser4gl.dsw(Microsoft Visual C++)

** /////////////////////////////YOUR PROGRAMM//////END STEP 4

 

 

**STEP 5  UPDATE / MISE A JOUR :OPCCODEX.H

 #define CodeExeHello 60120

** /////////////////////////////OPCCODEX.H//////END STEP 5

 

**STEP 6 //////COMPILER//COMPILATION/ Visual C++

 

 

**STEP 7 //////ENDUSER4GL.EXE//////////////////////////

Move c:\enduser4gl\4gl\bin\opensource\enduser4gl\debug\EndUser4gl.exe

to

c:\enduser4gl\4gl\bin\EndUser4gl.exe

 

 

 

**STEP 8 ////////////////////////////////////

exécutez votre nouvelle instruction dans un fichier à extension *.4glExe

submit your new instruction in a file to extension * 4glExe

ex : Hello.4glExe

 

  

Full Examples/pleins d'exemples

c:\EndUser4gl\4gl\Bin\TokensRules

 

 

 

 

Bergougnoux Consulting

14 rue Jean Moulin 37550 St Avertin, Tours FRANCE.

Copyright (c) 2001-2004 Enduser4gl,

Tous droits réservés.  All rights reserved

fax : 00 33 2 47 28 58 19

contact@enduser4gl.com