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

📄 parse_yy.v

📁 大3编译原理课程设计 绝对符合老师要求 报告代码一应俱全 很详细 很靠谱
💻 V
📖 第 1 页 / 共 2 页
字号:
#############################################################################
#                     U N R E G I S T E R E D   C O P Y
# 
# You are on day 12 of your 30 day trial period.
# 
# This file was produced by an UNREGISTERED COPY of Parser Generator. It is
# for evaluation purposes only. If you continue to use Parser Generator 30
# days after installation then you are required to purchase a license. For
# more information see the online help or go to the Bumble-Bee Software
# homepage at:
# 
# http://www.bumblebeesoftware.com
# 
# This notice must remain present in the file. It cannot be removed.
#############################################################################

#############################################################################
# parse_yy.v
# YACC verbose file generated from parse_yy.y.
# 
# Date: 12/19/08
# Time: 23:16:56
# 
# AYACC Version: 2.07
#############################################################################


##############################################################################
# Rules
##############################################################################

    0  $accept : program $end

    1  program : dec_list

    2  dec_list : dec_list dec
    3           | dec

    4  dec : var_dec
    5      | fun_dec
    6      | fun_def

    7  id : ID

    8  fid :

    9  var_dec : type_spec id_list SEMI

   10  id_list : id_list COMMA var
   11          | var
   12          | id_list COMMA id ASSIGN simple_exp
   13          | id ASSIGN simple_exp

   14  type_spec : INT
   15            | VOID

   16  fun_def : type_spec id fid LPAREN params RPAREN comp_stmt
   17          | id fid LPAREN params RPAREN comp_stmt

   18  fun_dec : type_spec id fid LPAREN params RPAREN SEMI
   19          | id fid LPAREN params RPAREN SEMI

   20  params : param_list
   21         |

   22  param_list : param_list COMMA param
   23             | param

   24  param : type_spec
   25        | type_spec id
   26        | type_spec id LBRA RBRA
   27        | type_spec id LBRA simple_exp RBRA

   28  comp_stmt : LBRACE local_dec stmt_list RBRACE

   29  local_dec : local_dec var_dec
   30            |

   31  stmt_list : stmt_list stmt
   32            |

   33  stmt : exp_stmt
   34       | sele_stmt
   35       | iter_stmt
   36       | return_stmt
   37       | comp_stmt

   38  exp_stmt : exp SEMI
   39           | SEMI

   40  sele_stmt : IF LPAREN exp RPAREN stmt
   41            | IF LPAREN exp RPAREN stmt ELSE stmt

   42  iter_stmt : WHILE LPAREN exp RPAREN stmt

   43  return_stmt : RETURN SEMI
   44              | RETURN exp SEMI

   45  exp : var ASSIGN exp
   46      | simple_exp

   47  var : id
   48      | id LBRA simple_exp RBRA

   49  simple_exp : simple_exp LT simple_exp
   50             | simple_exp LTEQ simple_exp
   51             | simple_exp GT simple_exp
   52             | simple_exp GTEQ simple_exp
   53             | simple_exp EQ simple_exp
   54             | simple_exp NOEQ simple_exp
   55             | simple_exp PLUS simple_exp
   56             | simple_exp MINUS simple_exp
   57             | simple_exp TIMES simple_exp
   58             | simple_exp OVER simple_exp
   59             | factor

   60  factor : LPAREN exp RPAREN
   61         | var
   62         | call
   63         | NUM

   64  call : var LPAREN args RPAREN

   65  arg_list : arg_list COMMA exp
   66           | exp

   67  args : arg_list
   68       |


##############################################################################
# States
##############################################################################

state 0
	$accept : . program $end

	INT  shift 1
	VOID  shift 2
	ID  shift 3

	program  goto 4
	dec_list  goto 5
	dec  goto 6
	var_dec  goto 7
	fun_dec  goto 8
	fun_def  goto 9
	id  goto 10
	type_spec  goto 11


state 1
	type_spec : INT .  (14)

	.  reduce 14


state 2
	type_spec : VOID .  (15)

	.  reduce 15


state 3
	id : ID .  (7)

	.  reduce 7


state 4
	$accept : program . $end  (0)

	$end  accept


state 5
	program : dec_list .  (1)
	dec_list : dec_list . dec

	INT  shift 1
	VOID  shift 2
	ID  shift 3
	.  reduce 1

	dec  goto 12
	var_dec  goto 7
	fun_dec  goto 8
	fun_def  goto 9
	id  goto 10
	type_spec  goto 11


state 6
	dec_list : dec .  (3)

	.  reduce 3


state 7
	dec : var_dec .  (4)

	.  reduce 4


state 8
	dec : fun_dec .  (5)

	.  reduce 5


state 9
	dec : fun_def .  (6)

	.  reduce 6


state 10
	fun_def : id . fid LPAREN params RPAREN comp_stmt
	fun_dec : id . fid LPAREN params RPAREN SEMI
	fid : .  (8)

	.  reduce 8

	fid  goto 13


state 11
	var_dec : type_spec . id_list SEMI
	fun_def : type_spec . id fid LPAREN params RPAREN comp_stmt
	fun_dec : type_spec . id fid LPAREN params RPAREN SEMI

	ID  shift 3

	id  goto 14
	id_list  goto 15
	var  goto 16


state 12
	dec_list : dec_list dec .  (2)

	.  reduce 2


state 13
	fun_def : id fid . LPAREN params RPAREN comp_stmt
	fun_dec : id fid . LPAREN params RPAREN SEMI

	LPAREN  shift 17


state 14
	id_list : id . ASSIGN simple_exp
	fun_def : type_spec id . fid LPAREN params RPAREN comp_stmt
	fun_dec : type_spec id . fid LPAREN params RPAREN SEMI
	var : id .  (47)
	var : id . LBRA simple_exp RBRA
	fid : .  (8)

	ASSIGN  shift 18
	LBRA  shift 19
	LPAREN  reduce 8
	.  reduce 47

	fid  goto 20


state 15
	var_dec : type_spec id_list . SEMI
	id_list : id_list . COMMA var
	id_list : id_list . COMMA id ASSIGN simple_exp

	SEMI  shift 21
	COMMA  shift 22


state 16
	id_list : var .  (11)

	.  reduce 11


state 17
	fun_def : id fid LPAREN . params RPAREN comp_stmt
	fun_dec : id fid LPAREN . params RPAREN SEMI
	params : .  (21)

	INT  shift 1
	VOID  shift 2
	.  reduce 21

	type_spec  goto 23
	params  goto 24
	param_list  goto 25
	param  goto 26


state 18
	id_list : id ASSIGN . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 31
	factor  goto 32
	call  goto 33


state 19
	var : id LBRA . simple_exp RBRA

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 34
	factor  goto 32
	call  goto 33


state 20
	fun_def : type_spec id fid . LPAREN params RPAREN comp_stmt
	fun_dec : type_spec id fid . LPAREN params RPAREN SEMI

	LPAREN  shift 35


state 21
	var_dec : type_spec id_list SEMI .  (9)

	.  reduce 9


state 22
	id_list : id_list COMMA . var
	id_list : id_list COMMA . id ASSIGN simple_exp

	ID  shift 3

	id  goto 36
	var  goto 37


state 23
	param : type_spec .  (24)
	param : type_spec . id
	param : type_spec . id LBRA RBRA
	param : type_spec . id LBRA simple_exp RBRA

	ID  shift 3
	.  reduce 24

	id  goto 38


state 24
	fun_def : id fid LPAREN params . RPAREN comp_stmt
	fun_dec : id fid LPAREN params . RPAREN SEMI

	RPAREN  shift 39


state 25
	params : param_list .  (20)
	param_list : param_list . COMMA param

	COMMA  shift 40
	.  reduce 20


state 26
	param_list : param .  (23)

	.  reduce 23


state 27
	factor : NUM .  (63)

	.  reduce 63


state 28
	factor : LPAREN . exp RPAREN

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 41
	simple_exp  goto 42
	exp  goto 43
	factor  goto 32
	call  goto 33


state 29
	var : id .  (47)
	var : id . LBRA simple_exp RBRA

	LBRA  shift 19
	.  reduce 47


state 30
	factor : var .  (61)
	call : var . LPAREN args RPAREN

	LPAREN  shift 44
	.  reduce 61


state 31
	id_list : id ASSIGN simple_exp .  (13)
	simple_exp : simple_exp . LT simple_exp
	simple_exp : simple_exp . LTEQ simple_exp
	simple_exp : simple_exp . GT simple_exp
	simple_exp : simple_exp . GTEQ simple_exp
	simple_exp : simple_exp . EQ simple_exp
	simple_exp : simple_exp . NOEQ simple_exp
	simple_exp : simple_exp . PLUS simple_exp
	simple_exp : simple_exp . MINUS simple_exp
	simple_exp : simple_exp . TIMES simple_exp
	simple_exp : simple_exp . OVER simple_exp

	PLUS  shift 45
	MINUS  shift 46
	TIMES  shift 47
	OVER  shift 48
	LT  shift 49
	LTEQ  shift 50
	GT  shift 51
	GTEQ  shift 52
	EQ  shift 53
	NOEQ  shift 54
	.  reduce 13


state 32
	simple_exp : factor .  (59)

	.  reduce 59


state 33
	factor : call .  (62)

	.  reduce 62


state 34
	var : id LBRA simple_exp . RBRA
	simple_exp : simple_exp . LT simple_exp
	simple_exp : simple_exp . LTEQ simple_exp
	simple_exp : simple_exp . GT simple_exp
	simple_exp : simple_exp . GTEQ simple_exp
	simple_exp : simple_exp . EQ simple_exp
	simple_exp : simple_exp . NOEQ simple_exp
	simple_exp : simple_exp . PLUS simple_exp
	simple_exp : simple_exp . MINUS simple_exp
	simple_exp : simple_exp . TIMES simple_exp
	simple_exp : simple_exp . OVER simple_exp

	PLUS  shift 45
	MINUS  shift 46
	TIMES  shift 47
	OVER  shift 48
	LT  shift 49
	LTEQ  shift 50
	GT  shift 51
	GTEQ  shift 52
	EQ  shift 53
	NOEQ  shift 54
	RBRA  shift 55


state 35
	fun_def : type_spec id fid LPAREN . params RPAREN comp_stmt
	fun_dec : type_spec id fid LPAREN . params RPAREN SEMI
	params : .  (21)

	INT  shift 1
	VOID  shift 2
	.  reduce 21

	type_spec  goto 23
	params  goto 56
	param_list  goto 25
	param  goto 26


state 36
	id_list : id_list COMMA id . ASSIGN simple_exp
	var : id .  (47)
	var : id . LBRA simple_exp RBRA

	ASSIGN  shift 57
	LBRA  shift 19
	.  reduce 47


state 37
	id_list : id_list COMMA var .  (10)

	.  reduce 10


state 38
	param : type_spec id .  (25)
	param : type_spec id . LBRA RBRA
	param : type_spec id . LBRA simple_exp RBRA

	LBRA  shift 58
	.  reduce 25


state 39
	fun_def : id fid LPAREN params RPAREN . comp_stmt
	fun_dec : id fid LPAREN params RPAREN . SEMI

	SEMI  shift 59
	LBRACE  shift 60

	comp_stmt  goto 61


state 40
	param_list : param_list COMMA . param

	INT  shift 1
	VOID  shift 2

	type_spec  goto 23
	param  goto 62


state 41
	exp : var . ASSIGN exp
	factor : var .  (61)
	call : var . LPAREN args RPAREN

	ASSIGN  shift 63
	LPAREN  shift 44
	.  reduce 61


state 42
	exp : simple_exp .  (46)
	simple_exp : simple_exp . LT simple_exp
	simple_exp : simple_exp . LTEQ simple_exp
	simple_exp : simple_exp . GT simple_exp
	simple_exp : simple_exp . GTEQ simple_exp
	simple_exp : simple_exp . EQ simple_exp
	simple_exp : simple_exp . NOEQ simple_exp
	simple_exp : simple_exp . PLUS simple_exp
	simple_exp : simple_exp . MINUS simple_exp
	simple_exp : simple_exp . TIMES simple_exp
	simple_exp : simple_exp . OVER simple_exp

	PLUS  shift 45
	MINUS  shift 46
	TIMES  shift 47
	OVER  shift 48
	LT  shift 49
	LTEQ  shift 50
	GT  shift 51
	GTEQ  shift 52
	EQ  shift 53
	NOEQ  shift 54
	.  reduce 46


state 43
	factor : LPAREN exp . RPAREN

	RPAREN  shift 64


state 44
	call : var LPAREN . args RPAREN
	args : .  (68)

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28
	.  reduce 68

	id  goto 29
	var  goto 41
	simple_exp  goto 42
	exp  goto 65
	factor  goto 32
	call  goto 33
	args  goto 66
	arg_list  goto 67


state 45
	simple_exp : simple_exp PLUS . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 68
	factor  goto 32
	call  goto 33


state 46
	simple_exp : simple_exp MINUS . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 69
	factor  goto 32
	call  goto 33


state 47
	simple_exp : simple_exp TIMES . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 70
	factor  goto 32
	call  goto 33


state 48
	simple_exp : simple_exp OVER . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 71
	factor  goto 32
	call  goto 33


state 49
	simple_exp : simple_exp LT . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 72
	factor  goto 32
	call  goto 33


state 50
	simple_exp : simple_exp LTEQ . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 73
	factor  goto 32
	call  goto 33


state 51
	simple_exp : simple_exp GT . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 74
	factor  goto 32
	call  goto 33


state 52
	simple_exp : simple_exp GTEQ . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 75
	factor  goto 32
	call  goto 33


state 53
	simple_exp : simple_exp EQ . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 76
	factor  goto 32
	call  goto 33


state 54
	simple_exp : simple_exp NOEQ . simple_exp

	ID  shift 3
	NUM  shift 27
	LPAREN  shift 28

	id  goto 29
	var  goto 30
	simple_exp  goto 77
	factor  goto 32
	call  goto 33


state 55
	var : id LBRA simple_exp RBRA .  (48)

	.  reduce 48


state 56

⌨️ 快捷键说明

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