Commit 5e92cb68 authored by moh_lo's avatar moh_lo

Revert "Compilable version"

This reverts commit 7ff04c0e.
parent 7ff04c0e
File mode changed from 100644 to 100755
This diff is collapsed.
#ifndef _EASEALEX_H
#define _EASEALEX_H
#include <clex.h>
#line 17 "C:\\repo\\src\\EaseaLex.l"
// forward references
class CEASEAParser;
class CSymbolTable;
#line 13 "C:\\repo\\src\\EaseaLex.h"
#define GENOME_ANALYSIS 2
#define TEMPLATE_ANALYSIS 4
#define MACRO_IDENTIFIER 6
#define MACRO_DEFINITION 8
#define COPY_USER_DECLARATIONS 10
#define COPY_INITIALISATION_FUNCTION 12
#define ANALYSE_USER_CLASSES 14
#define COPY_EO_INITIALISER 16
#define COPY 18
#define COPY_INITIALISER 20
#define COPY_CROSSOVER 22
#define COPY_MUTATOR 24
#define COPY_EVALUATOR 26
#define COPY_DISPLAY 28
#define COPY_USER_FUNCTION 30
#define COPY_USER_GENERATION 32
#define PARAMETERS_ANALYSIS 34
#define GET_PARAMETERS 36
#define COPY_USER_FUNCTIONS 38
#define COPY_GENERATION_FUNCTION 40
#define GET_METHODS 42
/////////////////////////////////////////////////////////////////////////////
// CEASEALexer
#ifndef YYDECLSPEC
#define YYDECLSPEC
#endif
class YYFAR YYDECLSPEC CEASEALexer : public yyflexer {
public:
CEASEALexer();
protected:
void yytables();
virtual int yyaction(int action);
public:
#line 31 "C:\\repo\\src\\EaseaLex.l"
protected:
CSymbolTable *pSymbolTable; // the symbol table
bool bSymbolInserted,bWithinEvaluator; // used to change evalutor type from double to float
bool bInitFunction,bDisplayFunction,bFunction, bNotFinishedYet, bWithinEO_Function;
bool bDoubleQuotes,bWithinDisplayFunction,bWithinInitialiser,bWithinMutator,bWithinXover;
bool bWaitingForSemiColon,bFinishNB_GEN,bFinishMINIMISE,bFinishMINIMIZE,bGenerationFunction;
bool bCatchNextSemiColon,bWaitingToClosePopulation, bMethodsInGenome;
CSymbol *pASymbol;
public:
int create(CEASEAParser* pParser, CSymbolTable* pSymbolTable);
int yywrap();
double myStrtod() const;
#line 67 "C:\\repo\\src\\EaseaLex.h"
};
#ifndef YYLEXNAME
#define YYLEXNAME CEASEALexer
#endif
#ifndef INITIAL
#define INITIAL 0
#endif
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
#ifndef _EASEAPARSE_H
#define _EASEAPARSE_H
#include <cyacc.h>
#line 58 "C:\\repo\\src\\EaseaParse.y"
// forward references
class CSymbol;
#line 12 "C:\\repo\\src\\EaseaParse.h"
#ifndef YYSTYPE
union tagYYSTYPE {
#line 64 "C:\\repo\\src\\EaseaParse.y"
CSymbol* pSymbol;
double dValue;
int ObjectQualifier;
int nValue;
char *szString;
#line 23 "C:\\repo\\src\\EaseaParse.h"
};
#define YYSTYPE union tagYYSTYPE
#endif
#define UMINUS 257
#define CLASSES 258
#define GENOME 259
#define USER_CTOR 260
#define USER_XOVER 261
#define USER_MUTATOR 262
#define USER_EVALUATOR 263
#define END_OF_FUNCTION 264
#define END_METHODS 265
#define IDENTIFIER 266
#define IDENTIFIER2 267
#define BOOL 268
#define INT 269
#define DOUBLE 270
#define FLOAT 271
#define CHAR 272
#define POINTER 273
#define NUMBER 274
#define NUMBER2 275
#define METHODS 276
#define STATIC 277
#define NB_GEN 278
#define NB_ISLANDS 279
#define PROP_SEQ 280
#define MUT_PROB 281
#define XOVER_PROB 282
#define POP_SIZE 283
#define SELECTOR 284
#define RED_PAR 285
#define RED_OFF 286
#define RED_FINAL 287
#define OFFSPRING 288
#define SURVPAR 289
#define SURVOFF 290
#define REPLACEMENT 291
#define DISCARD 292
#define MINIMAXI 293
#define ELITISM 294
#define ELITE 295
#define MIG_CLONE 296
#define MIG_SEL 297
#define MIGRATOR 298
#define MIG_FREQ 299
#define NB_MIG 300
#define IMMIG_SEL 301
#define IMMIG_REPL 302
#line 136 "C:\\repo\\src\\EaseaParse.y"
#include "EaseaSym.h"
#include "EaseaLex.h"
#line 80 "C:\\repo\\src\\EaseaParse.h"
/////////////////////////////////////////////////////////////////////////////
// CEASEAParser
#ifndef YYDECLSPEC
#define YYDECLSPEC
#endif
class YYFAR YYDECLSPEC CEASEAParser : public yyfparser {
public:
CEASEAParser();
protected:
void yytables();
virtual void yyaction(int action);
#ifdef YYDEBUG
void YYFAR* yyattribute1(int index) const;
void yyinitdebug(void YYFAR** p, int count) const;
#endif
public:
#line 143 "C:\\repo\\src\\EaseaParse.y"
protected:
CEASEALexer EASEALexer; // the lexical analyser
public:
CSymbolTable SymbolTable; // the symbol table
int create();
double assign(CSymbol* pIdentifier, double dValue);
double divide(double dDividend, double dDivisor);
void yysyntaxerror();
CSymbol* insert() const;
#line 115 "C:\\repo\\src\\EaseaParse.h"
};
#ifndef YYPARSENAME
#define YYPARSENAME CEASEAParser
#endif
#endif
......@@ -10,7 +10,6 @@ Centre de Math
****************************************************************************/
#include "Easea.h"
#include "debug.h"
// Globals
CSymbol *pCURRENT_CLASS;
......@@ -40,7 +39,7 @@ char sDISCARD_PRM[50];
int nMINIMISE=2;
int nELITE;
bool bELITISM=0;
bool bVERBOSE=1;
bool bVERBOSE=0;
int nPOP_SIZE, nOFF_SIZE, nSURV_PAR_SIZE, nSURV_OFF_SIZE;
int nNB_GEN;
int nNB_ISLANDS;
......@@ -94,7 +93,7 @@ class CSymbol;
%token USER_EVALUATOR
%token END_OF_FUNCTION
//%token DELETE
//%token <szString> WHATEVER_COMES_AFTER
%token <szString> END_METHODS
%token <pSymbol> IDENTIFIER
%token <pSymbol> IDENTIFIER2
%token <pSymbol> BOOL
......@@ -105,6 +104,7 @@ class CSymbol;
%token <pSymbol> POINTER
%token <dValue> NUMBER
%token <dValue> NUMBER2
%token METHODS
%token STATIC
%token NB_GEN
%token NB_ISLANDS
......@@ -136,7 +136,6 @@ class CSymbol;
%include {
#include "EaseaSym.h"
#include "EaseaLex.h"
#include <cyacc.h>
}
// parser name and class definition
......@@ -153,7 +152,6 @@ public:
double assign(CSymbol* pIdentifier, double dValue);
double divide(double dDividend, double dDivisor);
CSymbol* insert() const;
void yysyntaxerror();
}
// constructor
......@@ -200,14 +198,14 @@ EASEA : RunParameters GenomeAnalysis;
GenomeAnalysis
: ClassDeclarationsSection GenomeDeclarationSection {
if (bVERBOSE) printf(" _______________________________________\n");
if ((TARGET==DREAM)&& bVERBOSE) printf ("\nGeneration of the JAVA source files for %s : %s.cpp\n\n",sPROJECT_NAME,sPROJECT_NAME);
if ((TARGET!=DREAM)&& bVERBOSE) printf ("\nGeneration of the C++ source file for %s : %s.cpp\n\n",sPROJECT_NAME,sPROJECT_NAME);
if ((TARGET==DREAM)&& bVERBOSE) printf ("\nGeneration of the JAVA source files for %s.\n\n",sPROJECT_NAME);
if ((TARGET!=DREAM)&& bVERBOSE) printf ("\nGeneration of the C++ source file for %s.\n\n",sPROJECT_NAME);
}
StandardFunctionsAnalysis
| GenomeDeclarationSection {
if (bVERBOSE) printf(" _______________________________________\n");
if ((TARGET==DREAM)&& bVERBOSE) printf ("\nGeneration of the JAVA source files for %s : %s.cpp\n\n",sPROJECT_NAME,sPROJECT_NAME);
if ((TARGET!=DREAM)&& bVERBOSE) printf ("\nGeneration of the C++ source file for %s : %s.cpp\n\n",sPROJECT_NAME,sPROJECT_NAME);
if ((TARGET==DREAM)&& bVERBOSE) printf ("\nGeneration of the JAVA source files for %s.\n\n",sPROJECT_NAME);
if ((TARGET!=DREAM)&& bVERBOSE) printf ("\nGeneration of the C++ source file for %s.\n\n",sPROJECT_NAME);
}
StandardFunctionsAnalysis
;
......@@ -234,12 +232,6 @@ ClassDeclaration
'{' VariablesDeclarations '}' {
if (bVERBOSE) printf("Class %s declared for %d bytes.\n\n",$1->sName,$1->nSize);
}
MethodsDeclaration {}
;
MethodsDeclaration
: '[' Methods ']' {}
|
;
VariablesDeclarations
......@@ -251,6 +243,15 @@ VariablesDeclarations
VariablesDeclaration
: Qualifier BaseType {pCURRENT_TYPE=$2; pCURRENT_TYPE->ObjectQualifier=$1;} BaseObjects {}
| Qualifier UserType {pCURRENT_TYPE=$2; pCURRENT_TYPE->ObjectQualifier=$1;} UserObjects {}
| MethodsDeclaration
;
MethodsDeclaration
: METHODS END_METHODS{
pCURRENT_CLASS->sString = new char[strlen($2) + 1];
strcpy(pCURRENT_CLASS->sString, $2);
if (bVERBOSE) printf("\n The following methods have been declared:\n\n%s\n\n",pCURRENT_CLASS->sString);
}
;
Qualifier
......@@ -364,14 +365,14 @@ BaseConstructorParameter
: NUMBER {}
;
Methods
: Method
| Methods Method
;
//Methods
// : Method
// | Methods Method
// ;
Method
: NUMBER {}
;
//Method
// : NUMBER {}
// ;
GenomeDeclarationSection
: GENOME {
......@@ -381,11 +382,19 @@ GenomeDeclarationSection
pGENOME->pSymbolList=new CLList<CSymbol *>();
pGENOME->ObjectType=oUserClass;
pGENOME->ObjectQualifier=0;
pGENOME->sString=NULL;
}
'{' VariablesDeclarations '}' {
}
'{' VariablesDeclarations '}' {}
;
//GenomeMethodsDeclaration
// : GENOME_METHODS GENOME_END_METHODS{
// pCURRENT_CLASS->sString = new char[strlen($2) + 1];
// strcpy(pCURRENT_CLASS->sString, $2);
// }
// |
// ;
UserConstructorParameters
: UserConstructorParameter
| UserConstructorParameters UserConstructorParameter
......@@ -480,8 +489,8 @@ StandardFunctionAnalysis
;
RunParameters
: Parameter { DEBUG_YACC("parameter has been reduce\n");}
| RunParameters Parameter { DEBUG_YACC("parameter has been reduce\n");}
: Parameter
| RunParameters Parameter
;
Parameter
......@@ -1246,18 +1255,45 @@ Expr
int main(int argc, char *argv[]){
int n = YYEXIT_FAILURE;
int nParamNb=0;
char *psTemp;
char *sTemp;
int i=0;
TARGET=bVERBOSE=0;
sRAW_PROJECT_NAME[0]=0; // used to ask for a filename if no filename is found on the command line.
while ((++nParamNb) < argc) {
psTemp=&(argv[nParamNb][0]);
if ((argv[nParamNb][0]=='-')||(argv[nParamNb][0]=='/')) psTemp=&(argv[nParamNb][1]);
if (!mystricmp(psTemp,"eo")) TARGET=EO;
else if (!mystricmp(psTemp,"galib")) TARGET=GALIB;
else if (!mystricmp(psTemp,"dream")) TARGET=DREAM;
else if (!mystricmp(psTemp,"v")) bVERBOSE=true;
sTemp=&(argv[nParamNb][0]);
if ((argv[nParamNb][0]=='-')||(argv[nParamNb][0]=='/')) sTemp=&(argv[nParamNb][1]);
if (!mystricmp(sTemp,"eo")) TARGET=EO;
else if (!mystricmp(sTemp,"galib")) TARGET=GALIB;
else if (!mystricmp(sTemp,"dream")) TARGET=DREAM;
else if (!mystricmp(sTemp,"v")) bVERBOSE=true;
else if (!mystricmp(sTemp,"path")) {
if (argv[++nParamNb][0]=='"') {
strcpy(sEZ_PATH,&(argv[nParamNb][1]));
while (argv[++nParamNb][strlen(argv[nParamNb])]!='"')
strcat(sEZ_PATH,argv[nParamNb]);
argv[nParamNb][strlen(argv[nParamNb])]=0;
strcat(sEZ_PATH,argv[nParamNb]);
}
else {
if (argv[nParamNb][strlen(argv[nParamNb])-1]=='"') argv[nParamNb][strlen(argv[nParamNb])-1]=0;
strcpy(sEZ_PATH,argv[nParamNb]);
}
}
else if (!mystricmp(sTemp,"eo_dir")) {
if (argv[++nParamNb][0]=='"') {
strcpy(sEO_DIR,&(argv[nParamNb][1]));
while (argv[++nParamNb][strlen(argv[nParamNb])]!='"')
strcat(sEO_DIR,argv[nParamNb]);
argv[nParamNb][strlen(argv[nParamNb])]=0;
strcat(sEO_DIR,argv[nParamNb]);
}
else {
if (argv[nParamNb][strlen(argv[nParamNb])-1]=='"') argv[nParamNb][strlen(argv[nParamNb])-1]=0;
strcpy(sEO_DIR,argv[nParamNb]);
}
}
else strcpy(sRAW_PROJECT_NAME,argv[nParamNb]);
}
......@@ -1304,8 +1340,3 @@ double CEASEAParser::divide(double a, double b)
}
}
void CEASEAParser::yysyntaxerror(){
fprintf(stderr,"%s\t Error at line %d\n",sEZ_FILE_NAME,EASEALexer.yylineno);
exit(-1);
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -6,9 +6,11 @@ clex.h
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
Copyright (c) 1997-99 P. D. Stearns
************************************************************/
#define YY_ALEX
#include <stdio.h>
#include <assert.h>
......@@ -20,8 +22,6 @@ Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
#include <yytudefs.h>
#endif
#define YY_ALEX
// modifiers
#ifndef YYCDECL
#define YYCDECL
......
......@@ -6,9 +6,11 @@ cyacc.h
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
Copyright (c) 1997-99 P. D. Stearns
************************************************************/
#define YY_AYACC
#include <stdio.h>
#include <stddef.h>
#include <assert.h>
......@@ -21,8 +23,6 @@ Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
#include <yytudefs.h>
#endif
#define YY_AYACC
// modifiers
#ifndef YYCDECL
#define YYCDECL
......@@ -57,41 +57,41 @@ typedef short yystack_t;
#define YYTK_END 0 // $end token
#define YYTK_ERROR 256 // error token
#ifndef YYCSTATEGOTO_T
#define YYCSTATEGOTO_T
typedef short yycstategoto_t;
#endif
#ifndef YYCNONTERMGOTO_T
#define YYCNONTERMGOTO_T
typedef struct yycnontermgoto {
short nonterm; // nonterminal
short next; // next state
} yycnontermgoto_t;
typedef short yycnontermgoto_t;
#endif
#ifndef YYSTATEGOTO_T
#define YYSTATEGOTO_T
typedef struct yystategoto {
short base; // base
short def; // default state
} yystategoto_t;
#ifndef YYCSTATEGOTO_T
#define YYCSTATEGOTO_T
typedef struct yycstategoto {
short current; // current state
short next; // next state
} yycstategoto_t;
#endif
#ifndef YYNONTERMGOTO_T
#define YYNONTERMGOTO_T
typedef struct yynontermgoto {
short base; // base
short def; // default state
} yynontermgoto_t;
#endif
#ifndef YYSTATEGOTO_T
#define YYSTATEGOTO_T
typedef struct yystategoto {
short check; // check
short next; // next state
} yynontermgoto_t;
} yystategoto_t;
#endif
// action types
#define YYAT_SHIFT 0 // shift action
#define YYAT_REDUCE 1 // reduce action
#define YYAT_ERROR 2 // error
#define YYAT_ACCEPT 3 // accept
#define YYAT_DEFAULT 4 // default state
#define YYAT_SHIFT 0 // shift action
#define YYAT_REDUCE 1 // reduce action
#define YYAT_ERROR 2 // error
#define YYAT_ACCEPT 3 // accept
#define YYAT_DEFAULT 4 // default state
#ifndef YYCSTATEACTION_T
#define YYCSTATEACTION_T
......@@ -101,41 +101,39 @@ typedef short yycstateaction_t;
#ifndef YYCTOKENACTION_T
#define YYCTOKENACTION_T
typedef struct yyctokenaction {
int token; // lookahead token
unsigned char type; // action to perform
short sr; // state to shift/production to reduce
int token; // lookahead token
unsigned char type; // action to perform
short sr; // state to shift/production to reduce
} yyctokenaction_t;
#endif
#ifndef YYSTATEACTION_T
#define YYSTATEACTION_T
typedef struct yystateaction {
short base; // base
unsigned char lookahead; // lookahead needed
unsigned char type; // action to perform
short sr; // shift/reduce
short base; // base
unsigned char lookahead; // lookahead needed
unsigned char type; // action to perform
short sr; // shift/reduce
} yystateaction_t;
#endif
#ifndef YYTOKENACTION_T
#define YYTOKENACTION_T
typedef struct yytokenaction {
short check; // check
unsigned char type; // action type
short sr; // shift/reduce
short check; // check
unsigned char type; // action type
short sr; // shift/reduce
} yytokenaction_t;
#endif
// nonterminals
#define YYNT_ALL (-1) // match all nonterminals
// states
#define YYST_ERROR (-1) // goto error
#define YYST_ALL (-1) // match all states
#define YYST_ERROR (-1) // goto error
#ifndef YYREDUCTION_T
#define YYREDUCTION_T
typedef struct yyreduction {
short nonterm; // the rhs symbol
short rule; // the rhs symbol
short length; // number of symbols on lhs
short action; // the user action
} yyreduction_t;
......@@ -258,11 +256,11 @@ public:
void _yyerrok() { yysetskip(0); }
#endif
void yyexit(int exitcode) { yyexitflg = 1; yyexitcode = exitcode; }
void yyforceerror() { yythrowerror(); }
void yyforceerror() { yythrowerror(0); }
int yypopping() const { return yypopflg; }
int yyrecovering() const { return yyskip > 0; }
void yyretire(int retirecode) { yyretireflg = 1; yyretirecode = retirecode; }
void yythrowerror(int pop = 0) { yyerrorflg = 1; yyerrorpop = pop; }
void yythrowerror(int pop) { yyerrorflg = 1; yyerrorpop = pop; }
// compatibility
int yycparse() { return yyparse(); }
......@@ -308,7 +306,7 @@ protected:
void yydthrowerror(int errorpop) const;
void yydretire(int retirecode) const;
void yydattemptrecovery() const;
void yydebugoutput(const char* string) const;
void yydebugoutput(const char *string) const;
#endif
};
......@@ -326,9 +324,9 @@ protected:
const yystateaction_t YYNEARFAR* yystateaction;
const yytokenaction_t YYNEARFAR* yytokenaction;
int yytokenaction_size;
const yystategoto_t YYNEARFAR* yystategoto;
const yynontermgoto_t YYNEARFAR* yynontermgoto;
int yynontermgoto_size;
const yystategoto_t YYNEARFAR* yystategoto;
int yystategoto_size;
const yytokendest_t YYNEARFAR* yytokendestptr;
int yytokendest_size;
int yytokendestbase;
......@@ -347,8 +345,8 @@ public:
protected:
const yycstateaction_t YYNEARFAR* yycstateaction;
const yyctokenaction_t YYNEARFAR* yyctokenaction;
const yycstategoto_t YYNEARFAR* yycstategoto;
const yycnontermgoto_t YYNEARFAR* yycnontermgoto;
const yycstategoto_t YYNEARFAR* yycstategoto;
const yyctokendest_t YYNEARFAR* yyctokendestptr;
};
......
......@@ -6,9 +6,15 @@ lex.h
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
Copyright (c) 1997-99 P. D. Stearns
************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#define YY_ALEX
#include <stdio.h>
#include <assert.h>
......@@ -20,12 +26,6 @@ Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
#include <yytudefs.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define YY_ALEX
/* modifiers */
#ifndef YYCDECL
#define YYCDECL
......@@ -244,10 +244,6 @@ extern YYCONST yymatch_t YYNEARFAR YYDCDECL yymatch[];
extern YYCONST yystate_t YYNEARFAR YYDCDECL yystate[];
extern YYCONST yybackup_t YYNEARFAR YYDCDECL yybackup[];
#ifdef __cplusplus
}
#endif
/* user defines */
#if defined(YYBUDEFS) || defined(YYUDEFS)
#include <yybudefs.h>
......@@ -256,4 +252,8 @@ extern YYCONST yybackup_t YYNEARFAR YYDCDECL yybackup[];
/* defines */
#include <yybdefs.h>
#ifdef __cplusplus
};
#endif
#endif
......@@ -6,7 +6,7 @@ milconv.h
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
Copyright (c) 1997-99 P. D. Stearns
************************************************************/
/* variables */
......@@ -72,4 +72,17 @@ Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
#define YYSTATE (yy)->yymstart
#define YY_START (yy)->yymstart
#ifndef input
#define input() (*yy->yyminput)(yy)
#define YY_INPUT
#endif
#ifndef output
#define output(ch) (*yy->yymoutput)(yy, (ch))
#define YY_OUTPUT
#endif
#ifdef unput
#define unput(ch) (*yy->yymunput)(yy, (ch))
#define YY_UNPUT
#endif
#endif
......@@ -6,7 +6,7 @@ miyconv.h
This file can be freely modified for the generation of
custom code.
Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
Copyright (c) 1997-99 P. D. Stearns
************************************************************/
/* variables */
......@@ -43,7 +43,7 @@ Copyright (c) 1999-2001 Bumble-Bee Software Ltd.
#define yycparse() yymcparse(yy)
#define yycwipe() yymcwipe(yy)
#define yycwork() yymcwork(yy)
#define yydestructpop(num) yymdestructpop(yy, (num))
#define yydestructpop(num) yymdestructpop(yy, (pop))
#define yyparse() yymparse(yy)