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

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

?? tp4.y

?? YACC和LEX的資料書籍 以及一些源碼 很有幫助
?? Y
字號:

/* Turbo Pascal 4.0 grammar (prototype) 5-1-91 AG

   This is an "almost complete" TP Yacc grammar for Turbo Pascal Version
   4.0. Although the grammar is incomplete, untested and I do not have a
   lexical analyzer for it yet, I decided to include it in the distribution
   for those of you who are planning to write a Turbo Pascal parser.

   You will notice that this is not an adaption of the Standard Pascal
   grammar in PAS.Y. Because of the many additional features in the
   Turbo Pascal language I decided to write a new grammar from scratch.

   Writing a Yacc grammar for Turbo Pascal is not as easy as it first
   seems to be, because the special language features often defy easy
   specification as an LALR(1) grammar. Taking the naive approach, you
   are bound to get a lot of parsing conflicts in your grammar, since
   some of the constructs just cannot be parsed unambigiously without
   making use of semantic information.

   One construct that causes trouble is the qualified identifier which,
   in many contexts, can also be interpreted as a record component
   designator. To fix this, I simply decided to treat both "ordinary" and
   qualified identifiers as a single ID token. Of course this means that
   the lexical analyzer will have to distinguish between ordinary and
   qualified identifiers (this can be done with some semantic processing
   to determine which identifiers are unit names).

   There is still one ambiguity left in the grammar (causing one shift/
   reduce conflict) which comes from type casts in variable designators.
   The construct in question has the form:

      ID ( variable )

   In certain contexts, this can both be interpreted as a variable and
   as a function or procedure call. At present, the generated parser
   will parse such a construct as a variable. This will not be any
   problem (at least I hope so) unless you actually do semantic processing
   in your parser.

   If you have any questions/comments/critizism concerning this grammar,
   direct them to ag@muwiinfa.geschichte.uni-mainz.de. Perhaps someone
   even extends the grammar towards Turbo Pascal 5.x/6.x (if you do, it
   would be kind if you let me have a copy of this grammar such that I can
   include it in the next distribution). */


%start compilation_unit

/* Lexical stuff: */

%token

/* The multiple character symbols below are used in the grammar for better
   readability; identifier synonyms are given for use in the lexical analyzer.
   These definitions must come before any other token definitions (note that
   TP Yacc starts counting user-defined literals at 257). */

'..' 257
':=' 258
'<=' 259
'<>' 260
'>=' 261

%{

const

DOTDOT = 257
DEFEQ  = 258
LEQ    = 259
NEQ    = 260
GEQ    = 261

%}

%token

/* Keywords are stropped with underscores to prevent conflicts with Turbo
   Pascal keywords. */

_AND_		_ABSOLUTE_	_ARRAY_			_BEGIN_
_CASE_		_CONST_		_DIV_			_DOWNTO_
_DO_		_ELSE_		_END_			_EXTERNAL_
_FILE_		_FORWARD_	_FOR_			_FUNCTION_
_GOTO_		_IF_		_IMPLEMENTATION_ 	_INTERFACE_
_IN_		_LABEL_		_MOD_			_NIL_
_NOT_		_OF_		_OR_			_PACKED_
_PROCEDURE_	_PROGRAM_	_RECORD_		_REPEAT_
_SET_		_SHL_		_SHR_			_STRING_
_THEN_		_TO_		_TYPE_			_UNIT_
_UNTIL_		_USES_		_VAR_			_WHILE_
_WITH_		_XOR_

%right _THEN_ _ELSE_            /* resolve dangling else */

%token

ID
UNSIGNED_INTEGER
UNSIGNED_REAL
STRING_CONST

%%

compilation_unit
	: program
        | unit
        ;

/* Programs: */

program	: program_heading uses_clause block '.'
	;

program_heading
	: /* empty */
        | _PROGRAM_ ID ';'
        | _PROGRAM_ ID '(' id_list ')' ';'
	;

uses_clause
	: /* empty */
        | _USES_ id_list ';'
        ;

id_list	: ID
	| id_list ',' ID
        ;

block	: decl_sect_list compound_stmt
	;

/* Units: */

unit	: unit_heading interface_part implementation_part
	  initialization_part '.'
	;

unit_heading
	: _UNIT_ ID ';'
	;

interface_part
	: _INTERFACE_ uses_clause int_decl_sect_list
        ;

implementation_part
	: _IMPLEMENTATION_ decl_sect_list
        ;

initialization_part
	: compound_stmt
        | _END_
        ;

/* Declaration sections: */

decl_sect_list
	: /* empty */
        | decl_sect_list decl_sect
        ;

decl_sect
	: label_decl_sect
	| const_decl_sect
	| type_decl_sect
	| var_decl_sect
	| proc_decl
	| func_decl
	;

label_decl_sect
	: _LABEL_ label_list ';'
	;

label_list
	: label
        | label_list ',' label
        ;

label	: UNSIGNED_INTEGER
		/* must be decimal integer in the range 0..9999 */
	| ID
        ;

const_decl_sect
	: _CONST_ const_decl
	| const_decl_sect const_decl
	;

type_decl_sect
	: _TYPE_ type_decl
	| type_decl_sect type_decl
	;

var_decl_sect
	: _VAR_ var_decl
	| var_decl_sect var_decl
	;

/* Interface declaration sections: */

/* These appear instead of normal declaration sections in the interface
   part of a unit. The difference is that there are no label declarations
   and for procedures and functions only the headings are given. */

int_decl_sect_list
	: /* empty */
	| int_decl_sect_list int_decl_sect
	;

int_decl_sect
	: const_decl_sect
	| type_decl_sect
	| var_decl_sect
	| proc_heading
	| func_heading
	;

/* Constant declarations: */

const_decl
	: ID '=' const ';'
        | ID ':' type '=' typed_const ';'
        ;

const	: unsigned_number
	| sign unsigned_number
        | ID
        | sign ID
        | STRING_CONST
	;

unsigned_number
	: UNSIGNED_INTEGER
        | UNSIGNED_REAL
        ;

sign	: '+' | '-'
	;

typed_const
	: const
	| array_const
	| record_const
        | set_const
	;

array_const
	: '(' typed_const_list ')'
	;

typed_const_list
	: typed_const
	| typed_const_list ',' typed_const
	;

record_const
	: '(' const_field_list ')'
	;

const_field_list
	: const_field
	| const_field_list ',' const_field
	;

const_field
	: ID ':' typed_const
	;

set_const
	: '[' const_elem_list ']'
        ;

const_elem_list
	: /* empty */
        | const_elem_list1
        ;

const_elem_list1
	: const_elem
	| const_elem_list1 ',' const_elem
	;

const_elem
	: const
	| const '..' const
	;

/* Type declarations: */

type_decl
	: ID '=' type ';'
	;

type	: simple_type
	| pointer_type
        | structured_type
        | string_type
        ;

simple_type
	: ID
	| const '..' const	/* subrange */
	| '(' id_list ')'	/* enumeration */
	;

pointer_type
	: '^' ID
	;

structured_type
	: unpacked_structured_type
        | _PACKED_ unpacked_structured_type
        ;

unpacked_structured_type
	: array_type
	| record_type
	| set_type
	| file_type
	;

array_type
	: _ARRAY_ '[' simple_type_list ']' _OF_ type
	;

simple_type_list
	: simple_type
	| simple_type_list ',' simple_type
	;

record_type
	: _RECORD_ field_list _END_
	;

field_list
	: fixed_part
	| variant_part
	| fixed_part ';' variant_part
	;

fixed_part
	: record_section
	| fixed_part ';' record_section
	;

record_section
	: /* empty */
	| id_list ':' type
	;

variant_part
	: _CASE_ tag_field _OF_ variant_list
	;

tag_field
	: ID
	| ID ':' ID
	;

variant_list
	: variant
	| variant_list ';' variant
	;

variant	: /* empty */
	| case_tag_list ':' '(' field_list ')'
	;

case_tag_list
	: const
        | case_tag_list ',' const
        ;

set_type
	: _SET_ _OF_ simple_type
	;

file_type
	: _FILE_ _OF_ type
	| _FILE_
	;

string_type
	: _STRING_
	| _STRING_ '[' const ']'
	;

/* Variable declarations: */

var_decl
	: id_list ':' type absolute_clause ';'
	;

absolute_clause
	: /* empty */
        | _ABSOLUTE_ UNSIGNED_INTEGER ':' UNSIGNED_INTEGER
        | _ABSOLUTE_ ID
        ;

/* Procedure and function declarations: */

proc_decl
	: proc_heading proc_block ';'
	;

func_decl
	: func_heading proc_block ';'
	;

proc_heading
	: _PROCEDURE_ ID fp_list ';'
	;

func_heading
	: _FUNCTION_ ID fp_list ':' fptype ';'
	;

proc_block         	/* omitted inline and interrupt */
	: block
	| _EXTERNAL_
	| _FORWARD_
	;

fp_list : /* empty */
	| '(' fp_sect_list ')'
	;

fp_sect_list
	: fp_sect
	| fp_sect_list ';' fp_sect
	;

fp_sect	: id_list ':' fptype
	| _VAR_ id_list ':' fptype
	| _VAR_ id_list
	;

fptype	: ID
	| _STRING_
	;

/* Statements: */

stmt	: unlabelled_stmt
	| label ':' unlabelled_stmt
        ;

unlabelled_stmt
	: /* empty */
	| assignment
	| proc_call
	| goto_stmt
	| compound_stmt
	| if_stmt
	| case_stmt
	| repeat_stmt
	| while_stmt
	| for_stmt
	| with_stmt
	;

assignment
	: variable ':=' expr
	;

proc_call
	: ID param_list
	;

param_list
	: /* empty */
	| '(' expr_list ')'
	;

expr_list
	: expr
	| expr_list ',' expr
	;

goto_stmt
	: _GOTO_ label
	;

compound_stmt
	: _BEGIN_ stmt_list _END_
	;

stmt_list
	: stmt
	| stmt_list ';' stmt
	;

if_stmt	: _IF_ expr _THEN_ stmt
	| _IF_ expr _THEN_ stmt _ELSE_ stmt
	;

case_stmt
	: _CASE_ expr _OF_ case_list else_case _END_
	;

case_list
	: case
	| case_list ';' case
	;

case	: /* empty */
	| case_label_list ':' stmt
	;

case_label_list
	: case_label
        | case_label_list ',' case_label
        ;

case_label
	: const
        | const '..' const
        ;

else_case
	: /* empty */
	| _ELSE_ stmt
	| _ELSE_ stmt ';'
	;

repeat_stmt
	: _REPEAT_ stmt_list _UNTIL_ expr
	;

while_stmt
	: _WHILE_ expr _DO_ stmt
	;

for_stmt
	: _FOR_ ID ':=' expr _TO_ expr _DO_ stmt
	| _FOR_ ID ':=' expr _DOWNTO_ expr _DO_ stmt
	;

with_stmt
	: _WITH_ variable_list _DO_ stmt
	;

variable_list
	: variable
        | variable_list ',' variable
        ;

/* Variables: */

variable
	: ID
	| variable '[' expr_list ']'		/* array component */
	| variable '.' ID			/* record field */
        | variable '^'				/* pointer value */
	| ID '(' variable ')'		        /* type cast */
	;

/* Expressions: */

expr	: simple_expr
	| simple_expr relop simple_expr
        ;

relop	: '=' | '<>' | '<' | '>' | '<=' | '>=' | _IN_
        ;

simple_expr
	: term
        | sign term
        | simple_expr addop term
        ;

addop	: '+' | '-' | _OR_ | _XOR_
	;

term	: factor
	| term mulop factor
        ;

mulop	: '*' | '/' | _DIV_ | _MOD_ | _SHL_ | _SHR_
	;

/* Parameterless function calls, and function calls looking like type
   casts are caught as variables. */

factor	: variable
	| UNSIGNED_INTEGER
        | UNSIGNED_REAL
        | STRING_CONST
        | '[' elem_list ']'
        | _NIL_
        | '@' variable
        | '(' expr ')'
        | ID '(' expr_list ')'
        | _NOT_ factor
        ;

elem_list
	: /* empty */
        | elem_list1
        ;

elem_list1
	: elem
	| elem_list1 ',' elem
	;

elem	: expr
	| expr '..' expr
	;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一级二级| 色婷婷亚洲一区二区三区| 亚洲网友自拍偷拍| 一个色在线综合| 午夜免费久久看| 日本不卡不码高清免费观看| 午夜电影久久久| 日韩国产成人精品| 日本人妖一区二区| 极品少妇xxxx精品少妇偷拍| 国产精品性做久久久久久| 丁香激情综合国产| 91啪亚洲精品| 欧美乱妇一区二区三区不卡视频| 欧美精三区欧美精三区| 日韩一级黄色片| 国产日韩欧美精品一区| 亚洲欧美日韩国产综合在线| 午夜日韩在线电影| 国产精品综合在线视频| 99精品视频在线播放观看| 欧美日韩一区二区三区免费看| 日韩一级视频免费观看在线| 国产欧美日韩在线| 一区二区高清在线| 激情深爱一区二区| www.欧美日韩| 欧美久久久久免费| 中文字幕乱码久久午夜不卡| 亚洲国产欧美日韩另类综合| 免费美女久久99| 91色九色蝌蚪| 精品国产伦一区二区三区观看方式 | 国产精品久久福利| 午夜视频一区二区| 国产精品亚洲第一区在线暖暖韩国| 99久久伊人精品| 日韩欧美123| 亚洲日本欧美天堂| 久久av中文字幕片| 91福利在线免费观看| 久久午夜老司机| 亚洲永久免费av| 国产99一区视频免费| 欧美人牲a欧美精品| 国产精品久久午夜| 精品在线观看视频| 91精品国产色综合久久ai换脸 | 国产日韩欧美精品一区| 丝袜亚洲另类欧美| 99久久国产综合精品麻豆| 欧美mv和日韩mv的网站| 亚洲午夜久久久久久久久电影院| 国产乱人伦偷精品视频不卡| 91福利在线导航| 亚洲欧美激情一区二区| 国产99久久久久| 日韩欧美在线网站| 午夜亚洲国产au精品一区二区| 不卡一区在线观看| 中文字幕不卡三区| 国产在线精品免费| 精品国产污网站| 老鸭窝一区二区久久精品| 欧美午夜精品理论片a级按摩| 亚洲人成伊人成综合网小说| 高清视频一区二区| 中文av一区二区| 福利91精品一区二区三区| 亚洲精品一区二区三区香蕉| 美女视频一区二区三区| 日韩一区二区视频在线观看| 日韩精品三区四区| 制服丝袜在线91| 捆绑调教一区二区三区| 日韩免费视频线观看| 美国十次综合导航| 日韩视频一区二区三区| 精品一区二区三区在线观看国产| 日韩三级视频在线观看| 国内久久精品视频| 国产精品免费av| 色综合久久综合网欧美综合网| 亚洲精品中文在线影院| 在线视频综合导航| 日本少妇一区二区| 久久久美女毛片| 不卡av在线免费观看| 亚洲国产精品一区二区www| 欧美视频一区二区| 美女在线观看视频一区二区| 26uuu色噜噜精品一区| 成人黄色国产精品网站大全在线免费观看| 久久精品亚洲精品国产欧美| av不卡一区二区三区| 亚洲午夜激情网站| 亚洲精品一区二区精华| 成人污视频在线观看| 亚洲国产综合91精品麻豆| 日韩一区二区在线观看视频| 国产高清久久久久| 亚洲国产精品久久久久婷婷884 | 国产精品亚洲专一区二区三区 | 久久国产视频网| 国产精品乱码一区二区三区软件| 91在线国产福利| 蜜桃一区二区三区在线| 国产精品网友自拍| 在线播放亚洲一区| 成人国产视频在线观看| 日韩综合小视频| 国产精品不卡在线| 日韩欧美123| 在线一区二区观看| 国产a级毛片一区| 麻豆免费精品视频| 亚洲乱码国产乱码精品精98午夜| 欧美一区二区免费观在线| av电影天堂一区二区在线| 免费一区二区视频| 亚洲午夜久久久久久久久久久 | 国产欧美一二三区| 91精品国产色综合久久| www..com久久爱| 国产麻豆成人传媒免费观看| 亚洲小说春色综合另类电影| 国产欧美日韩精品一区| 欧美一级一区二区| 欧美日韩视频专区在线播放| 成人在线一区二区三区| 国产在线播放一区三区四| 丝袜国产日韩另类美女| 亚洲一二三四区不卡| 中文字幕一区二区日韩精品绯色| 精品国产网站在线观看| 欧美一二三区精品| 欧美一区二区观看视频| 欧美日韩国产a| 欧美午夜不卡在线观看免费| 99精品一区二区三区| aaa国产一区| av中文字幕亚洲| 懂色av一区二区三区蜜臀| 国产一区三区三区| 国产一区二区三区国产| 国产乱码一区二区三区| 捆绑调教一区二区三区| 久久精品国产99久久6| 日韩电影一区二区三区四区| 亚洲v日本v欧美v久久精品| 亚洲国产中文字幕在线视频综合| 一区二区三区四区在线免费观看| 最新不卡av在线| 依依成人精品视频| 亚洲一二三专区| 日本伊人午夜精品| 久久99在线观看| 国产成人av影院| 成年人国产精品| 在线观看视频91| 在线91免费看| 精品理论电影在线| 久久久久久久久久久久久夜| 国产欧美一区视频| 最新久久zyz资源站| 亚洲精品视频在线看| 午夜精品福利一区二区蜜股av | 精品国产免费久久| 日本一区二区三区国色天香 | 毛片av中文字幕一区二区| 国产一区二区在线看| 成人免费高清在线| 在线亚洲+欧美+日本专区| 91精品国产品国语在线不卡| 精品免费国产二区三区| 中文字幕精品一区 | 在线成人高清不卡| 精品成人一区二区三区| 日韩理论电影院| 男女性色大片免费观看一区二区 | 一区二区三区中文在线| 丝袜美腿亚洲一区二区图片| 国产自产2019最新不卡| 一本一本大道香蕉久在线精品| 欧美日韩国产综合视频在线观看| 日韩三级免费观看| 亚洲视频在线观看三级| 日本不卡的三区四区五区| 成人99免费视频| 日韩免费福利电影在线观看| 国产精品福利av| 久久国产精品色婷婷| 91黄视频在线| 国产日韩欧美精品在线| 视频一区视频二区中文字幕| 国产盗摄视频一区二区三区| 51精品秘密在线观看| 综合电影一区二区三区| 精品亚洲免费视频| 欧美日韩精品免费|