PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
ParserTest.cpp File Reference
#include "../base/Evaluator.h"
#include "../base/grammar.tab.hpp"
#include "../base/PNode.h"
#include "../base/Loader.h"
#include "../base/PComplexData.h"
#include "../base/PList.h"
#include "../libs/PEBLObjects.h"
#include <iostream>

Go to the source code of this file.

Functions

PNodeparse ()
 
int PEBLInterpret (int argc, char **argv)
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 116 of file ParserTest.cpp.

117{
118 cout << "This testing program is deprecated.\n";
119
120 //return PEBLInterpret(argc, argv);
121 return 0;
122}

◆ parse()

PNode * parse ( )

Referenced by main(), PEBLInterpret(), and PEBLInterpret().

◆ PEBLInterpret()

int PEBLInterpret ( int  argc,
char **  argv 
)

Definition at line 42 of file ParserTest.cpp.

43{
44
45 //This sets the video driver
46 setenv("SDL_VIDEODRIVER", "dga",1); //Requires to run with root privileges, fullscreen.
47 setenv("SDL_VIDEODRIVER", "x11",1);
48
50 FunctionMap * myFunctionMap= new FunctionMap();
51
52 PNode *node1;
53 node1=NULL;
54
55
56 //First, parse the file.
57 node1 = parse();
58 cerr << "---------Program Parsed---------" << endl;
59
60 cerr << "---------Loading Program---------" << endl;
61 //Now, load it into the environment.
62 myLoader = new Loader(myFunctionMap);
63
65
66 cerr <<"Analyzing code for functions." << endl;
67 myLoader->FindFunctions(node1);
68
69 cerr << "Loading Library functions." << endl;
71
72 cerr << "Loaded Functions: " << endl;
74
75
76
77 cerr << "Creating a PlatformEnvironment\n";
79
80
81 cerr << "---------Creating Evaluator-----" << endl;
82
83 PList * pList = new PList();
84 pList->PushFront(Variant(0));
85
86 cout << "Getting list inside list: " << *pList <<endl;
87
88 PComplexData * pcd = new PComplexData(pList);
89 Variant v = Variant(pcd);
90
91 Evaluator myEval = Evaluator(myFunctionMap, v);
92 //Now, everything should be F-I-N-E fine.
93
94 cerr << "--------Getting main function---" << endl;
96
97 if(node1)
98 {
99
100 cerr << "---------Evaluating Program-----" << endl;
101 //Execute everything
102 myEval.Evaluate(node1);
103 return 0;
104 }
105 else
106 {
107 cerr << "Error: Can't evaluate program" << endl;
108 return 1;
109 }
110
111}
#define NULL
Definition BinReloc.cpp:317
Evaluator * myEval
Definition PEBL.cpp:188
Loader * myLoader
Definition PEBL.cpp:219
PNode * parse()
This class has got everything you need to evaluate stuff.
bool Evaluate(const PNode *node)
void DumpFunctionSet()
Definition Loader.cpp:385
void LoadUserFunctions(OpNode *node)
Definition Loader.cpp:147
void LoadLibraryFunctions()
Definition Loader.cpp:195
void FindFunctions(const PNode *Node)
Definition Loader.cpp:88
PNode * GetMainPEBLFunction()
Definition Loader.cpp:372
Definition PList.h:45
Definition PNode.h:45
void MakeEnvironment(PEBLVideoMode mode, PEBLVideoDepth depth, bool windowed, bool resizeable, bool unicode)
This function instantiates the namespace-viewable.

References Loader::DumpFunctionSet(), Evaluator::Evaluate(), Loader::FindFunctions(), Loader::GetMainPEBLFunction(), Loader::LoadLibraryFunctions(), Loader::LoadUserFunctions(), PEBLObjects::MakeEnvironment(), myEval, myLoader, NULL, and parse().