亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? scc-parser.y

?? 這是一些于C++做的經典例子
?? Y
字號:
%{
// This file contains all of the rules for GNU Bison.  This grammar defines a
// very simple language that can only understand the very basic match
// instructions.  Nevertheless, this still shows the basics of code generation.

#include "SCC.H"
#include "PTNode.H"
#include "CodeGen.H"

%}


// Define the order of precidence for the operators.  The first line has the
// lowest precidence and the last line has the highest.  Operators on the same
// line have the same precidence, and these operators associate to the left.
// For example, the following expressions are equivalent:
//
//    2 + 3 + 5 + 7
//    ( (2 + 3) + 5) + 7
//
// This defines the operator precidence as you would expect.

// Note that these first two lines gets rid of the "dangling else" with
// C-style if statements.  Since Bison only has a single token of look ahead,
// it does not know if an if-statement will contain an else or not.  These two
// rules help Bison get rid of this conflict.
%nonassoc LESS_THAN_ELSE
%nonassoc K_ELSE

%left '='
%left '+' '-'
%left '*' '/'



// Define the set of tokens that the lexer will give the parser.  The compiler
// only understands numbers, basic identifiers, and a small handful of
// keywords.
%token NUMBER
%token IDENTIFIER

%token K_ELSE
%token K_FOR
%token K_IF


%%


// This rule is where Bison starts (since this is the first rule), and it
// defines what a valid source file.  For this sample, a source file is simply
// a list of statements.
file : stmtList
         {
           // This block of code will be executed once the statement list is
           // "reduced" or completely matched.  Since this is the first rule
           // that Bison started with, parsing of the source script has been
           // completed.  We dump the parse tree that was built up, and then
           // run the code generator over this parse tree.

           // Note that the $1, $2, etc match the "return results" of the of
           // the rule's arguments (e.g., the right side of the colon).  $1 in
           // this rule's case is the result of 'stmtList'.  Rules can set
           // their return values by setting $$.

           $1->Dump();

           CodeGen cg;
           cg.StartGen( $1 );
         }
     ;


// This rule defines a list of one or more statements.  Notice how this rule
// refers to itself recusively.  The second part of this rule (just the single
// 'stmt') will always be matched first.  This little bit of code handles
// creating a block parse tree node that will contain the entire list of
// statements.  If there are any additional statements, they will be matched
// by the first part of this rule (notice how its code adds the new statement
// to the end of block node).
stmtList : stmtList stmt           { $$ = $1;  $$->Add( $2 );  }
         | stmt                    { $$ = new BlockNode( $1 ); }
         ;


// This rule defines what a statement is.  This rule simply passes the "what
// is a statement" definition to sub-rules.
stmt : block_stmt                  { $$ = $1; }
     | expr_stmt                   { $$ = $1; }
     | for_stmt                    { $$ = $1; }
     | if_stmt                     { $$ = $1; }
     ;


// A block statement is any statement list that is surrounded by braces.  This
// is commonly used in if-statements and for-loops to group a body of
// statements.
block_stmt : '{' stmtList '}'      { $$ = $2; }
           ;


// An expression statement is a any expression followed by a semicolon.  This
// will be the most common type of statement in a script.  Since an expression
// will leave its value on the stack, the code generator will generate pops to
// cleanup the stack when it encounters statement nodes.
expr_stmt : expr ';'               { $$ = new StatementNode( $1 ); }
          ;


// This rule defines a C-style for-loop.
for_stmt : K_FOR '(' opt_expr ';' opt_expr ';' opt_expr ';' ')' stmt
             {
               // In order to keep the for-loop's data structure a little more
               // convient, it does not expect any of its arguments to be
               // NULL.  Therefore, we need to create dummy nodes where
               // appropiate.  Note that when the conditional is empty, that
               // means we should really push a constant 1 on the stack (ie,
               // true).
               PTNodePtr pre = $3;
               PTNodePtr expr = $5;
               PTNodePtr post = $7;
               PTNodePtr body = $10;

               if ( pre == NULL )
                 pre = new StatementNode( NULL );

               if ( expr == NULL )
                 pre = new ConstantNode( 1 );

               if ( post == NULL )
                 post = new StatementNode( NULL );

               if ( body == NULL )
                 body = new StatementNode( NULL );

               $$ = new ForNode( pre, expr, post, body );
             }


// This rule defines an optional expression.  This is used by the for-loop so
// its various parts can be empty.
opt_expr : expr                    { $$ = $1;   }
         | /* empty */             { $$ = NULL; }
         ;


// This rule defines a C-style if-statement.  Note that there are two sub
// rules that actually deal with the if-statement's details (whether or not
// the if statement has an else).
if_stmt : if_no_else_stmt          { $$ = $1; }
        | if_with_else_stmt        { $$ = $1; }
        ;


// This rule defines an C-style if-statement that does not contain an else.
// Since Bison only has a single token of look-ahead, this rule conflicts with
// if_with_else_stmt; therefore, we force Bison to drop the precidence of this
// rule.  This effectively binds the else with the closest if (just like C).
if_no_else_stmt : K_IF '(' expr ')'
                    stmt     %prec LESS_THAN_ELSE
                                   { $$ = new IfNode( $3, $5 ); }
                ;


if_with_else_stmt : K_IF '(' expr ')'
                      stmt
                    K_ELSE
                      stmt
                                   { $$ = new IfNode( $3, $5, $7 ); }
                  ;


// This rule defines what an expression.  An expression can be a single number
// (the last rule), or it can be any list basic math instructions.  Each of
// these rules handles creating the proper parse tree node with the operands.
expr : expr '+' expr               { $$ = new AddNode( $1, $3 );        }
     | expr '-' expr               { $$ = new SubtractNode( $1, $3 );   }
     | expr '*' expr               { $$ = new MultiplyNode( $1, $3 );   }
     | expr '/' expr               { $$ = new DivideNode( $1, $3 );     }
     | '(' expr ')'                { $$ = $2;                           }
     | IDENTIFIER '=' expr         { $$ = new AssignmentNode( $1, $3 ); }
     | NUMBER                      { $$ = $1;                           }
     | IDENTIFIER                  { $$ = $1;                           }
     ;


%%


// This function is required to be defined by Bison.  It is called whenever
// any kind of error is raised while parsing the input stream.
int yyerror( char *err )
{
  puts( err );

  return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美喷潮久久久xxxxx| 91丨porny丨最新| 日韩欧美不卡一区| 青青草原综合久久大伊人精品 | 精品国产亚洲一区二区三区在线观看 | 一区二区三区小说| 欧美综合一区二区| 视频一区二区欧美| 欧美一级高清大全免费观看| 精品制服美女丁香| 欧美激情一区二区三区全黄| 色偷偷一区二区三区| 亚洲成人一区在线| 亚洲精品在线网站| av电影在线观看一区| 亚洲国产美国国产综合一区二区| 51精品久久久久久久蜜臀| 九九久久精品视频| 国产精品久久毛片a| 欧美日韩精品是欧美日韩精品| 日韩av成人高清| 中文字幕av一区二区三区| 一本大道久久精品懂色aⅴ | 中文字幕一区二区三区不卡 | 国产在线精品一区二区夜色| 国产精品乱码人人做人人爱| 欧美性受xxxx黑人xyx性爽| 蜜桃av噜噜一区| 国产精品麻豆欧美日韩ww| 欧美日韩中文字幕一区| 狠狠色丁香婷婷综合久久片| 日韩伦理免费电影| 欧美va日韩va| 欧洲精品视频在线观看| 激情欧美一区二区| 一区二区三区色| 久久久久国产精品麻豆ai换脸 | 欧美三级韩国三级日本三斤| 国产一区二区h| 亚洲成人自拍网| 国产精品少妇自拍| 日韩欧美国产精品| 色琪琪一区二区三区亚洲区| 美女视频黄频大全不卡视频在线播放| 国产精品全国免费观看高清| 欧美一区二区黄| 色综合天天做天天爱| 激情av综合网| 天天综合色天天综合色h| 国产精品国产三级国产专播品爱网| 7777女厕盗摄久久久| 91免费版在线| 国产69精品一区二区亚洲孕妇 | 狠狠色狠狠色综合系列| 亚洲国产精品久久人人爱| 国产精品免费丝袜| 久久久久久久久久久久久久久99 | 精品国产一区二区三区四区四| 欧美中文字幕久久| 91一区二区在线观看| 国产黑丝在线一区二区三区| 男男gaygay亚洲| 亚洲电影你懂得| 一区二区三区四区亚洲| 中文字幕五月欧美| 国产精品国产a级| 国产精品无圣光一区二区| 久久综合色鬼综合色| 日韩一级完整毛片| 欧美一区二区在线免费播放| 欧美少妇bbb| 欧美日韩一区二区电影| 欧美中文字幕一二三区视频| 色婷婷国产精品综合在线观看| 99久久综合国产精品| 菠萝蜜视频在线观看一区| 国产白丝精品91爽爽久久| 国产福利91精品一区| 国产在线播放一区三区四| 黄色资源网久久资源365| 国产乱子伦一区二区三区国色天香| 秋霞影院一区二区| 久久99精品国产.久久久久| 精品在线你懂的| 国产精品一区二区黑丝| 成人一区在线看| 91理论电影在线观看| 91久久一区二区| 欧美猛男男办公室激情| 欧美一区二区在线免费观看| 欧美大片一区二区三区| 久久日韩精品一区二区五区| 国产午夜三级一区二区三| 国产精品国产自产拍高清av| 亚洲国产精品黑人久久久| 自拍偷拍亚洲欧美日韩| 亚洲最新视频在线观看| 日韩电影一区二区三区四区| 国模一区二区三区白浆| 成人一区在线观看| 在线国产亚洲欧美| 精品伦理精品一区| 中文在线资源观看网站视频免费不卡| 亚洲婷婷在线视频| 日韩主播视频在线| 国产成人精品一区二区三区四区| 成人福利视频在线看| 欧美在线短视频| 2021国产精品久久精品| 亚洲色图在线看| 日韩精品电影在线| 国产精品99久久不卡二区| 色老汉一区二区三区| 日韩视频一区在线观看| 国产精品久久国产精麻豆99网站| 亚洲福利电影网| 国产九九视频一区二区三区| 一本久道中文字幕精品亚洲嫩| 欧美一区二区啪啪| 国产精品狼人久久影院观看方式| 日韩中文字幕不卡| 99久久久无码国产精品| 91精品中文字幕一区二区三区| 欧美极品xxx| 日韩精品一二三| av亚洲精华国产精华| 日韩午夜av一区| 亚洲精品成人在线| 国产精品亚洲人在线观看| 欧美在线视频你懂得| 久久精品夜夜夜夜久久| 天天操天天色综合| 99在线精品观看| 欧美电影免费观看高清完整版在线 | 成人avav影音| 欧美刺激午夜性久久久久久久| 亚洲视频网在线直播| 黄页网站大全一区二区| 欧美日韩国产综合视频在线观看 | 久久电影网站中文字幕| 色综合天天综合在线视频| 亚洲精品一区二区三区精华液| 亚洲欧美经典视频| 成人性生交大合| 久久综合九色综合欧美98| 亚洲成av人片一区二区| www.日韩av| 国产亚洲一本大道中文在线| 麻豆精品蜜桃视频网站| 欧美日本国产一区| 亚洲国产成人高清精品| 91成人免费在线视频| 亚洲欧美综合网| 成人免费视频视频在线观看免费| 久久综合九色综合97婷婷女人| 日日骚欧美日韩| 制服丝袜成人动漫| 亚洲成av人片观看| 欧美日韩一级黄| 亚洲午夜一区二区| 色88888久久久久久影院按摩| 国产精品不卡一区| 成人黄色免费短视频| 欧美激情一区二区三区蜜桃视频| 国产一区美女在线| 久久久久国产精品人| 国产激情视频一区二区三区欧美| 337p粉嫩大胆色噜噜噜噜亚洲| 美女视频黄 久久| 精品国产乱码久久久久久老虎| 麻豆精品在线播放| 欧美精品一区二区三区久久久| 久久精品国产99国产精品| 精品国产区一区| 国产69精品久久99不卡| 国产精品女主播av| 99久久99久久精品免费看蜜桃| 亚洲丝袜制服诱惑| 在线观看欧美黄色| 午夜精品福利一区二区蜜股av| 在线播放中文字幕一区| 精品中文字幕一区二区| 国产日产欧美一区二区三区| www.欧美亚洲| 亚洲综合色视频| 91精品国产品国语在线不卡| 九九热在线视频观看这里只有精品| 久久久久久久久久久久久久久99| 成人h动漫精品| 亚洲国产精品欧美一二99| 日韩美一区二区三区| 国产69精品久久777的优势| 亚洲精品菠萝久久久久久久| 欧美久久高跟鞋激| 国产美女一区二区三区| 亚洲三级理论片| 欧美一级欧美三级在线观看 | 免费xxxx性欧美18vr| 欧美激情在线观看视频免费| 在线观看av一区二区|