#include <interpret.h>
Collaboration diagram for Interpret:

Public Member Functions | |
| Interpret (Lexer &SedLex) | |
| ~Interpret (void) | |
| const bool | Run (void) |
Protected Member Functions | |
| virtual void | Initialize (void) |
| virtual void | ShiftRule (const int TopSymbol) |
| virtual const bool | ReduceRule (const int TopSymbol) |
Private Attributes | |
| Lexer & | duraLex |
|
|
Definition at line 90 of file interpret.cpp. References Initialize().
00091 : duraLex( SedLex ) 00092 { 00093 Initialize(); 00094 } |
|
|
Definition at line 75 of file interpret.h.
00076 {
00077 for( deque<TreeNode *>::iterator it = begin() ; it != end() ; ++it )
00078 delete (*it);
00079 clear();
00080 };
|
|
|
Definition at line 142 of file interpret.cpp. References duraLex, and Lexer::EofId(). Referenced by Interpret().
|
|
|
Definition at line 156 of file interpret.cpp. References TreeNode::child, and TreeNode::next. Referenced by Run().
|
|
|
case of Error Definition at line 105 of file interpret.cpp. References Lexer::atSr(), duraLex, Lexer::GetConstant(), Lexer::GetTopSymbol(), ReduceRule(), and ShiftRule(). Referenced by Ars::ExprIntParser::Eval(), Ars::ExprParser::Eval(), and ExprParser::Eval().
00106 {
00107 int ts = duraLex.GetTopSymbol();
00108
00109 while( ts != -1 )
00110 {
00111 switch( duraLex.atSr( back()->symbolId , ts ) )
00112 {
00113 default :
00114 case ' ' :
00115 { printf( "syntax error:\n" );
00116 for( deque<TreeNode*>::iterator it = begin() ; it != end() ; ++it )
00117 {
00118 const char *s = (*it)->constant.empty() ? "" : (*it)->constant.c_str();
00119 printf( "%s\t" , s );
00120 }
00121 printf( "\nwith terminal symbol: %s\n" , duraLex.GetConstant().c_str() );
00122 }
00123 return false;
00124
00125 case '=' : // Shift the stack... according to the grammar rule
00126 case '<' : // Shift the stack... according to the grammar rule
00127 ShiftRule( ts );
00128 ts = duraLex.GetTopSymbol();
00129 break;
00130
00131 case '>' : // Reduce
00132 if( !ReduceRule( ts ) )
00133 return false;
00134 break;
00135 case '$' :
00136 return true;
00137 }
00138 }
00139 return true;
00140 }
|
|
|
Definition at line 148 of file interpret.cpp. References duraLex, Lexer::GetConstant(), and TreeNode::next. Referenced by Run().
00149 {
00150 TreeNode *tn2 = back();
00151 back()->next = new TreeNode( TopSymbol , duraLex.GetConstant() );
00152 push_back( back()->next );
00153 tn2 = back();
00154 }
|
|
|
Definition at line 69 of file interpret.h. Referenced by Initialize(), Run(), and ShiftRule(). |
1.3.3