⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fcl-parser.yy

📁 parse fuzzy contrl language file
💻 YY
字号:
#line 7421 "../../doc/bison.texinfo"%skeleton "lalr1.cc"                          /*  -*- C++ -*- */%require "2.1a"%defines%define "parser_class_name" "fcl_parser"#line 7437 "../../doc/bison.texinfo"%{#include <string>using namespace std;class fcl_driver;%}#line 7450 "../../doc/bison.texinfo"// The parsing context.%parse-param { fcl_driver& driver }%lex-param   { fcl_driver& driver }#line 7463 "../../doc/bison.texinfo"%locations%initial-action{  // Initialize the initial location.  @$.begin.filename = @$.end.filename = &driver.file;};#line 7477 "../../doc/bison.texinfo"%debug%error-verbose#line 7487 "../../doc/bison.texinfo"// Symbols.%union{  	int 		ival;	float		fval;	std::string *sval;};#line 7502 "../../doc/bison.texinfo"%{#include "fcl-driver.hh"%}%token FUNCTION_BLOCK END_FUNCTION_BLOCK VAR_OUTPUT VAR_INPUT END_VAR %token FUZZIFY END_FUZZIFY DEFUZZIFY END_DEFUZZIFY TERM %token METHOD COG COGS COA LM RM%token RULEBLOCK END_RULEBLOCK RANGE ACT ACCU%token RULE	IF THEN	IS%token AND OR MAX MIN PROD ASUM BSUM BDIF NSUM%token 	REAL WS%token	ASSIGN	":="%token	COLON	":"%token	SEMI	";"%token	COMMA	","%token	LPAREN	"("%token	RPAREN	")"%token	DPOINT	".."#line 7517 "../../doc/bison.texinfo"%token        END      0 "end of file"%token <sval> IDENTIFIER "identifier"%token <ival> NUMBER     "number"//%type  <ival> exp        "expression"#line 7531 "../../doc/bison.texinfo"%printer    { debug_stream () << *$$; } "identifier"%destructor { delete $$; } "identifier"//%printer    { debug_stream () << $$; } "number" "expression"#line 7542 "../../doc/bison.texinfo"%start commands;%%commands :	| commands command END_FUNCTION_BLOCK	{		std::cout << "Creacion satisfactoria de modelo difuso:" << std::endl;	}	;command	:	open_function_block_declaration	;open_function_block_declaration :	 	FUNCTION_BLOCK "identifier"	{		std::string fuzzyName = *$2;		std::cout << "Creando el modelo difuso: " << fuzzyName << endl;			}		declarations		function_block_body	;declarations :	VAR_INPUT input_vars_decls END_VAR	VAR_OUTPUT output_vars_decls END_VAR;input_vars_decls	: input_var_decl	| input_vars_decls input_var_decl	;input_var_decl 	:	"identifier" COLON REAL SEMI	{		std::string varName = *$1;	}	;output_vars_decls	: output_var_decl	| output_vars_decls output_var_decl	;output_var_decl 	:	"identifier" COLON REAL SEMI	{		std::string varName = *$1;	}	;function_block_body : 	fuzzify_blocks defuzzify_blocks rule_block;fuzzify_blocks : fuzzify_block	| fuzzify_blocks fuzzify_block	;fuzzify_block 	: 	FUZZIFY	"identifier"	{		string varName = *$2;	}		range 		linguistic_terms 	END_FUZZIFY	;defuzzify_blocks : defuzzify_block	| defuzzify_blocks defuzzify_block	;defuzzify_block :	DEFUZZIFY "identifier"		range 		linguistic_terms		defuzzification_method	END_DEFUZZIFY	;linguistic_terms : linguistic_term	| linguistic_terms linguistic_term	;linguistic_term : 	TERM "identifier" ASSIGN membership_function SEMI;membership_function : 	singleton | points;singleton : "number";points : point	| points point	;point :	LPAREN "number" COMMA "number" RPAREN;defuzzification_method : 	| METHOD COLON defuzz SEMI;defuzz : COG | COGS | LM | RM ;range : 	RANGE ASSIGN LPAREN "number" DPOINT "number" RPAREN SEMI;rule_block : 	RULEBLOCK "identifier"		operator_definition		activation_method		accumulation_method		rules	END_RULEBLOCK;operator_definition : 	AND COLON and_ope SEMI	| OR COLON or_ope SEMI	;or_ope : MAX | ASUM | BSUM;and_ope : MIN | PROD | BDIF;activation_method :	| ACT COLON act SEMI;act : PROD | MIN ;accumulation_method : 	ACCU COLON acc SEMI	;acc : MAX | BSUM | NSUM;rules: rule	| rules rule;rule : 	RULE NUMBER COLON IF conditions THEN conclusion SEMI	;conditions: condition	| conditions AND condition	;condition : 	LPAREN "identifier" IS "identifier" RPAREN	| "identifier";                           conclusion :	LPAREN "identifier" IS "identifier" RPAREN	| "identifier";%%#line 7568 "../../doc/bison.texinfo"voidyy::fcl_parser::error (const yy::fcl_parser::location_type& l,                          const std::string& m){  	driver.error (l, m);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -