|
PH Logo
Logo intepreter modeled after UCB Logo.
|
00001 /* 00002 * Interpreter.h 00003 * 00004 * Author: Paul Hamilton 00005 * Date: 6 Jun 2011 00006 * 00007 */ 00008 #ifndef _INTERPRETER_H 00009 #define _INTERPRETER_H 00010 00011 #include "Types.h" 00012 00013 #include <string> 00014 #include <iterator> 00015 #include <vector> 00016 #include <boost/shared_ptr.hpp> 00017 00018 namespace phlogo { 00019 00020 class World; 00021 class Verbs; 00022 class Func; 00023 class Thing; 00024 class Tokenizer; 00025 00030 class Interpreter { 00031 00032 public: 00033 Interpreter(World *world); 00034 00035 Verbs *getVerbs() { return _verbs.get(); } 00036 00037 void setDebug(bool on) { _debug = on; } 00038 00042 void run(World *world, const std::string &sentence); 00043 00047 void runTokenized(World *world, const std::string &tokenized); 00048 00052 void defun(const std::string &name, const std::string &args); 00053 void end(); 00054 00058 wList sentence2words(const std::string &sentence); 00059 00063 pThing varOrLiteral(World *world, const std::string &s); 00064 00068 void getNextThing(World *world, TokenStream *ts, pThing *thing); 00069 00070 private: 00071 boost::shared_ptr<Verbs> _verbs; 00072 boost::shared_ptr<Tokenizer> _tk; 00073 Func *_openfunc; 00074 bool _debug; 00075 00076 }; 00077 00078 } 00079 00080 #endif // _INTERPRETER_H
1.7.4