📄 sintactic.h.svn-base
字号:
/*************************************************************************** * Copyright (C) 2007 by Orivaldo Vieira Santana Jr orivajr@dcc.ufba.br * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************//*! \file Sintactic.h<pre><b>File:</b> Sintactic.h<b>Project:</b> Robocup Soccer Simulation Team: MecaTeam<b>Authors:</b> Orivaldo Santana Jr <orivajr@dcc.ufba.br><b>Created:</b> 10/09/2006<b>Last Revision:</b> $ID$<b>Contents:</b> Este arquivo cont閙 a declara玢o da classe Sintactic. Esta classe faz a an醠ise sint醫ica do analisador de regras do sistema baseado em conhecimento do agente. Ela foi projetada como trabalho da discicplina MAT153 - Compiladores - ministrada pelo professor Luciano Barreto.<hr size=2><h2><b>Changes</b></h2><b>Date</b> <b>Author</b> <b>Comment</b>19/09/2006 Orivaldo Vieira Documenta玢o</pre> - - - BNF simplificada das regras do agente MecaTeam. - - -Nota珲es: [ nome ] signifaca ter zero ou uma ocorr阯cia de nome { nome } significa ter uma ou mais ocorr阯cias de nomeProdu珲es: regras ::= "(" { "(" regra ")" } ")" regra ::= "id" "real" "(" lado_esquerdo ")" [ "(" filtro ") ] "(" lado_direito ")" lado_esquerdo ::= "if" { "(" representa玢o_conhecimento ")" } lado_direito ::= "then" { "(" representa玢o_conhecimento ")" } representa玢o_conhecimento ::= "logic" "(" id_var id_var id_var ")" representa玢o_conhecimento ::= "message" "(" "(" "to" "id" ")" "(" "from" "id" ")" [ "(" "deadline" "inteiro" ")" ] [ "(" "grade" "real" ")" ] [ "(" "alpha" "real" ")" ] [ "(" "round" "real" ")" ] "(" "body" "(" { token } ")" ")" ")" representa玢o_conhecimento ::= "frame" "(" "variavel" "(" { "(" { id } ")" "(" "id" id_var ")" } ")" ")" filtro ::= "filter" { "(" "operador" parametro parametro ")" } id_var ::= "id" | "variavel" parametro ::= id_var | "real"*/#ifndef SINTACTIC_H#define SINTACTIC_H#include <list>#include <vector>#include <map>#include "Token.h"#include "TokenTypes.h"#include "Rule.h"struct lessThenString{ bool operator()(string s1, string s2) { return s1 < s2; }};// tipo usado para associar um token string a token enumera玢o.typedef map <string, string*, lessThenString> SymbolTable;class Sintactic { private: list<Token>::iterator m_itTokenList; list<Token>* m_ptrTokenList; RulesLogicPattern* m_ptrCurrentPattern; Filter* m_ptrCurrentFilter; Rule* m_ptrCurrentRule; SymbolTable m_symbolTable; void generateKnowledge ( TokenT t, SideRuleT s ); bool showErro ( string hopedValue ); bool rules ( vector<Rule*> &ptrV ); Rule* rule ( ); bool leftSide ( ); bool rightSide ( ); int filter ( ); TokenT knowledgeRepresentation ( ); string idVar ( ); string parameter ( ); bool goForwardToken ( ); public: Sintactic (list<Token>* _ptrTokenList); void analyse ( vector<Rule*> &RV );};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -