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

📄 parse.v

📁 一个C语言的编译器
💻 V
📖 第 1 页 / 共 4 页
字号:
#############################################################################
#                     U N R E G I S T E R E D   C O P Y
# 
# You are on day 49 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.v
# YACC verbose file generated from parse.y.
# 
# Date: 12/23/08
# Time: 20:50:56
# 
# AYACC Version: 2.06
#############################################################################


##############################################################################
# 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            | DOUBLE
   16            | CHAR
   17            | VOID

   18  fun_def : type_spec id fid LP params RP comp_stmt
   19          | id fid LP params RP comp_stmt

   20  fun_dec : type_spec id fid LP params RP SEMI
   21          | id fid LP params RP SEMI

   22  params : param_list
   23         |

   24  param_list : param_list COMMA param
   25             | param

   26  param : type_spec
   27        | type_spec id

   28  comp_stmt : LFP local_dec stmt_list RFP

   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       | input_stmt
   39       | output_stmt

   40  exp_stmt : exp SEMI
   41           | SEMI

   42  sele_stmt : IF LP exp RP stmt
   43            | IF LP exp RP stmt ELSE stmt

   44  iter_stmt : WHILE LP exp RP stmt
   45            | FOR LP exp_stmt exp_stmt exp RP stmt

   46  input_stmt : INPUT LP id RP SEMI

   47  output_stmt : OUTPUT LP id RP SEMI

   48  return_stmt : RETURN SEMI
   49              | RETURN exp SEMI

   50  exp : var ASSIGN exp
   51      | simple_exp

   52  var : id
   53      | id LSP factor RSP

   54  simple_exp : simple_exp OR simple_exp
   55             | simple_exp AND simple_exp
   56             | simple_exp LT simple_exp
   57             | simple_exp LE simple_exp
   58             | simple_exp GT simple_exp
   59             | simple_exp GE simple_exp
   60             | simple_exp EQ simple_exp
   61             | simple_exp NEQ simple_exp
   62             | simple_exp PLUS simple_exp
   63             | simple_exp SUB simple_exp
   64             | simple_exp MUT simple_exp
   65             | simple_exp DIV simple_exp
   66             | simple_exp MOD simple_exp
   67             | simple_exp INC
   68             | LP INC simple_exp RP
   69             | simple_exp DEC
   70             | LP DEC simple_exp RP
   71             | simple_exp B_AND simple_exp
   72             | simple_exp B_XOR simple_exp
   73             | simple_exp B_OR simple_exp
   74             | simple_exp B_LEFT factor
   75             | simple_exp B_RIGHT factor
   76             | NOT factor
   77             | B_NOT factor
   78             | factor

   79  factor : LP exp RP
   80         | var
   81         | call
   82         | NUM
   83         | FNUM
   84         | SCHAR

   85  call : var LP args RP

   86  arg_list : arg_list COMMA exp
   87           | exp

   88  args : arg_list
   89       |


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

state 0
	$accept : . program $end

	INT  shift 1
	CHAR  shift 2
	DOUBLE  shift 3
	VOID  shift 4
	ID  shift 5

	program  goto 6
	dec_list  goto 7
	dec  goto 8
	var_dec  goto 9
	fun_dec  goto 10
	fun_def  goto 11
	type_spec  goto 12
	id  goto 13


state 1
	type_spec : INT .  (14)

	.  reduce 14


state 2
	type_spec : CHAR .  (16)

	.  reduce 16


state 3
	type_spec : DOUBLE .  (15)

	.  reduce 15


state 4
	type_spec : VOID .  (17)

	.  reduce 17


state 5
	id : ID .  (7)

	.  reduce 7


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

	$end  accept


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

	INT  shift 1
	CHAR  shift 2
	DOUBLE  shift 3
	VOID  shift 4
	ID  shift 5
	.  reduce 1

	dec  goto 14
	var_dec  goto 9
	fun_dec  goto 10
	fun_def  goto 11
	type_spec  goto 12
	id  goto 13


state 8
	dec_list : dec .  (3)

	.  reduce 3


state 9
	dec : var_dec .  (4)

	.  reduce 4


state 10
	dec : fun_dec .  (5)

	.  reduce 5


state 11
	dec : fun_def .  (6)

	.  reduce 6


state 12
	var_dec : type_spec . id_list SEMI
	fun_def : type_spec . id fid LP params RP comp_stmt
	fun_dec : type_spec . id fid LP params RP SEMI

	ID  shift 5

	var  goto 15
	id_list  goto 16
	id  goto 17


state 13
	fun_def : id . fid LP params RP comp_stmt
	fun_dec : id . fid LP params RP SEMI
	fid : .  (8)

	.  reduce 8

	fid  goto 18


state 14
	dec_list : dec_list dec .  (2)

	.  reduce 2


state 15
	id_list : var .  (11)

	.  reduce 11


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

	SEMI  shift 19
	COMMA  shift 20


state 17
	id_list : id . ASSIGN simple_exp
	fun_def : type_spec id . fid LP params RP comp_stmt
	fun_dec : type_spec id . fid LP params RP SEMI
	var : id .  (52)
	var : id . LSP factor RSP
	fid : .  (8)

	ASSIGN  shift 21
	LSP  shift 22
	LP  reduce 8
	.  reduce 52

	fid  goto 23


state 18
	fun_def : id fid . LP params RP comp_stmt
	fun_dec : id fid . LP params RP SEMI

	LP  shift 24


state 19
	var_dec : type_spec id_list SEMI .  (9)

	.  reduce 9


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

	ID  shift 5

	var  goto 25
	id  goto 26


state 21
	id_list : id ASSIGN . simple_exp

	ID  shift 5
	NUM  shift 27
	FNUM  shift 28
	SCHAR  shift 29
	LP  shift 30
	B_NOT  shift 31
	NOT  shift 32

	var  goto 33
	simple_exp  goto 34
	factor  goto 35
	call  goto 36
	id  goto 37


state 22
	var : id LSP . factor RSP

	ID  shift 5
	NUM  shift 27
	FNUM  shift 28
	SCHAR  shift 29
	LP  shift 38

	var  goto 33
	factor  goto 39
	call  goto 36
	id  goto 37


state 23
	fun_def : type_spec id fid . LP params RP comp_stmt
	fun_dec : type_spec id fid . LP params RP SEMI

	LP  shift 40


state 24
	fun_def : id fid LP . params RP comp_stmt
	fun_dec : id fid LP . params RP SEMI
	params : .  (23)

	INT  shift 1
	CHAR  shift 2
	DOUBLE  shift 3
	VOID  shift 4
	.  reduce 23

	params  goto 41
	param_list  goto 42
	param  goto 43
	type_spec  goto 44


state 25
	id_list : id_list COMMA var .  (10)

	.  reduce 10


state 26
	id_list : id_list COMMA id . ASSIGN simple_exp
	var : id .  (52)
	var : id . LSP factor RSP

	ASSIGN  shift 45
	LSP  shift 22
	.  reduce 52


state 27
	factor : NUM .  (82)

	.  reduce 82


state 28
	factor : FNUM .  (83)

	.  reduce 83


state 29
	factor : SCHAR .  (84)

	.  reduce 84


state 30
	simple_exp : LP . INC simple_exp RP
	simple_exp : LP . DEC simple_exp RP
	factor : LP . exp RP

	ID  shift 5
	NUM  shift 27
	FNUM  shift 28
	SCHAR  shift 29
	LP  shift 30
	INC  shift 46
	DEC  shift 47
	B_NOT  shift 31
	NOT  shift 32

	exp  goto 48
	var  goto 49
	simple_exp  goto 50
	factor  goto 35
	call  goto 36
	id  goto 37


state 31
	simple_exp : B_NOT . factor

	ID  shift 5
	NUM  shift 27
	FNUM  shift 28
	SCHAR  shift 29
	LP  shift 38

	var  goto 33
	factor  goto 51
	call  goto 36
	id  goto 37


state 32
	simple_exp : NOT . factor

	ID  shift 5
	NUM  shift 27
	FNUM  shift 28
	SCHAR  shift 29
	LP  shift 38

	var  goto 33
	factor  goto 52
	call  goto 36
	id  goto 37


state 33
	factor : var .  (80)
	call : var . LP args RP

	LP  shift 53
	.  reduce 80


state 34
	id_list : id ASSIGN simple_exp .  (13)
	simple_exp : simple_exp . OR simple_exp
	simple_exp : simple_exp . AND simple_exp
	simple_exp : simple_exp . LT simple_exp
	simple_exp : simple_exp . LE simple_exp
	simple_exp : simple_exp . GT simple_exp
	simple_exp : simple_exp . GE simple_exp
	simple_exp : simple_exp . EQ simple_exp
	simple_exp : simple_exp . NEQ simple_exp
	simple_exp : simple_exp . PLUS simple_exp
	simple_exp : simple_exp . SUB simple_exp
	simple_exp : simple_exp . MUT simple_exp
	simple_exp : simple_exp . DIV simple_exp
	simple_exp : simple_exp . MOD simple_exp
	simple_exp : simple_exp . INC
	simple_exp : simple_exp . DEC
	simple_exp : simple_exp . B_AND simple_exp
	simple_exp : simple_exp . B_XOR simple_exp
	simple_exp : simple_exp . B_OR simple_exp
	simple_exp : simple_exp . B_LEFT factor
	simple_exp : simple_exp . B_RIGHT factor

	PLUS  shift 54
	SUB  shift 55
	MUT  shift 56
	DIV  shift 57
	MOD  shift 58
	INC  shift 59
	DEC  shift 60
	B_AND  shift 61
	B_OR  shift 62
	B_XOR  shift 63
	B_LEFT  shift 64
	B_RIGHT  shift 65
	EQ  shift 66
	GT  shift 67
	LT  shift 68
	GE  shift 69
	LE  shift 70
	NEQ  shift 71
	AND  shift 72
	OR  shift 73
	.  reduce 13


state 35
	simple_exp : factor .  (78)

	.  reduce 78


state 36
	factor : call .  (81)

	.  reduce 81


state 37
	var : id .  (52)
	var : id . LSP factor RSP

	LSP  shift 22
	.  reduce 52


state 38
	factor : LP . exp RP

	ID  shift 5
	NUM  shift 27
	FNUM  shift 28
	SCHAR  shift 29
	LP  shift 30
	B_NOT  shift 31
	NOT  shift 32

	exp  goto 48
	var  goto 49
	simple_exp  goto 50
	factor  goto 35
	call  goto 36
	id  goto 37


state 39
	var : id LSP factor . RSP

	RSP  shift 74


state 40
	fun_def : type_spec id fid LP . params RP comp_stmt
	fun_dec : type_spec id fid LP . params RP SEMI
	params : .  (23)

	INT  shift 1
	CHAR  shift 2
	DOUBLE  shift 3
	VOID  shift 4
	.  reduce 23

	params  goto 75
	param_list  goto 42
	param  goto 43
	type_spec  goto 44


state 41
	fun_def : id fid LP params . RP comp_stmt
	fun_dec : id fid LP params . RP SEMI

	RP  shift 76


state 42
	params : param_list .  (22)
	param_list : param_list . COMMA param

	COMMA  shift 77
	.  reduce 22


state 43
	param_list : param .  (25)

	.  reduce 25


state 44
	param : type_spec .  (26)
	param : type_spec . id

	ID  shift 5
	.  reduce 26

	id  goto 78


state 45
	id_list : id_list COMMA id ASSIGN . simple_exp

	ID  shift 5
	NUM  shift 27
	FNUM  shift 28
	SCHAR  shift 29
	LP  shift 30
	B_NOT  shift 31
	NOT  shift 32

	var  goto 33
	simple_exp  goto 79
	factor  goto 35
	call  goto 36
	id  goto 37


state 46
	simple_exp : LP INC . simple_exp RP

⌨️ 快捷键说明

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