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

📄 ada语法.c

📁 语言的语法,格式严紧,对于处理yacc,lex有帮助!
💻 C
📖 第 1 页 / 共 3 页
字号:
X MOD_ | 

X REM_; 

X 

X/* 

X * highest_precedence_op : 

X * EXP_ 

X * ABS_ 

X * NOT_; 

X * 

X * This is an unused syntactic class. 

X */ 

X 

X 

X/* 4.6 */ 

X 

X/* 

X * included under name 

X * 

X * ty_cnvr : ty_mk '(' expr ')'; 

X */ 

X 

X 

X/* 4.7 */ 

Xqualified_expr : ty_mkaggr_or_ty_mkPexprP_; 

X 

X 

X/* 4.8 */ 

Xallocator : 

X NEW_ ty_mk | 

X NEW_ ty_mk aggr | 

X NEW_ ty_mk '\'' aggr; 

X 

X 

X/* 5.1 */ 

Xseq_of_stmts : ..prag.. stmt ..stmt..; 

X 

Xstmt : 

X ..label.. sim_stmt | 

X ..label.. compound_stmt | 

X error ';'; 

X 

X/* procedure and ent call stmts are included under name */ 

Xsim_stmt : 

X null_stmt | 

X assignment_stmt | 

X exit_stmt | 

X return_stmt | 

X goto_stmt | 

X delay_stmt | 

X abort_stmt | 

X raise_stmt | 

X code_stmt | 

X name ';'; 

X 

Xcompound_stmt : 

X if_stmt | 

X case_stmt | 

X loop_stmt | 

X block_stmt | 

X accept_stmt | 

X select_stmt; 

X 

Xlabel : L_LBL_ sim_n R_LBL_; 

X 

Xnull_stmt : NULL_ ';'; 

X 

X 

X/* 5.2 */ 

Xassignment_stmt : name ASSIGN_ expr ';'; 

X 

X 

X/* 5.3 */ 

Xif_stmt : 

X IF_ cond THEN_ 

X   seq_of_stmts 

X ..ELSIF__cond__THEN__seq_of_stmts.. 

X .ELSE__seq_of_stmts. 

X END_ IF_ ';'; 

X 

Xcond : expr; 

X 

X 

X/* 5.4 */ 

Xcase_stmt : 

X CASE_ expr IS_ 

X   case_stmt_alt..case_stmt_alt.. 

X END_ CASE_ ';'; 

X 

Xcase_stmt_alt : 

X WHEN_ choice ..or_choice.. ARROW_ 

X   seq_of_stmts; 

X 

X 

X/* 5.5 */ 

Xloop_stmt : 

X .sim_nC. 

X   .iteration_scheme. LOOP_ 

X     seq_of_stmts 

X   END_ LOOP_ .sim_n. ';'; 

X 

Xiteration_scheme : 

X WHILE_ cond | 

X FOR_ loop_prm_spec; 

X 

Xloop_prm_spec : 

X identifier IN_ .REVERSE. dscr_rng; 

X 

X 

X/* 5.6 */ 

Xblock_stmt : 

X .sim_nC. 

X   .DECLARE__decl_part. 

X   BEGIN_ 

X     seq_of_stmts 

X   .EXCEPTION__excptn_handler..excptn_handler... 

X   END_ .sim_n. ';'; 

X 

X 

X/* 5.7 */ 

Xexit_stmt : EXIT_ .expanded_n. .WHEN__cond. ';'; 

X 

X 

X/* 5.8 */ 

Xreturn_stmt : RETURN_ .expr. ';'; 

X 

X 

X/* 5.9 */ 

Xgoto_stmt : GOTO_ expanded_n ';'; 

X 

X 

X/* 6.1 */ 

Xsubprg_d : subprg_spec ';'; 

X 

Xsubprg_spec : 

X PROCEDURE_ identifier .fml_part. | 

X FUNCTION_ designator .fml_part. RETURN_ ty_mk; 

X 

Xdesignator : 

X identifier | 

X op_symbol; 

X 

Xop_symbol : string_literal; 

X 

Xfml_part : '(' prm_spec .._.prm_spec.. ')'; 

X 

Xprm_spec : idents ':' mode ty_mk ._ASN_expr.; 

X 

Xmode : 

X .IN. | 

X IN_ OUT_ | 

X OUT_; 

X 

X 

X/* 6.3 */ 

Xsubprg_body : 

X subprg_spec IS_ 

X   .decl_part. 

X BEGIN_ 

X   seq_of_stmts 

X .EXCEPTION__excptn_handler..excptn_handler... 

X END_ .designator. ';'; 

X 

X 

X/* 6.4 */ 

X 

X/* 

X * procedure_call_stmt : procedure_n .act_prm_part. ';'; 

X * 

X * func_call : func_n .act_prm.; 

X * 

X * act_prm_part : '(' prm_asc ... prm_asc .._paren; 

X * 

X * prm_asc : .fml_prm ARROW. act_prm; 

X * 

X * fml_prm : sim_n; 

X * 

X * act_prm : 

X * expr | 

X * name | 

X * ty_mk '(' name ')'; 

X * 

X * procedure_call_stmt and func_call are included under name 

X */ 

X 

X 

X/* 7.1 */ 

Xpkg_d : pkg_spec ';'; 

X 

Xpkg_spec : 

X PACKAGE_ identifier IS_ 

X   ..basic_decl_item.. 

X   .PRIVATE..basic_decl_item... 

X END_ .sim_n.; 

X 

Xpkg_body : 

X PACKAGE_ BODY_ sim_n IS_ 

X   .decl_part. 

X   .BEGIN__seq_of_stmts.EXCEPTION__excptn_handler..excptn_handler... 

X END_ .sim_n. ';'; 

X 

X 

X/* 7.4 */ 

Xpriv_ty_d : 

X TYPE_ identifier IS_ .LIMITED. PRIVATE_ ';' | 

X TYPE_ identifier discr_part IS_ .LIMITED. PRIVATE_ ';'; 

X 

X/* 

X * included under object_d 

X * 

X * defer_const_d : idents : CONSTANT_ ty_mk ';'; 

X */ 

X 

X 

X/* 8.4 */ 

Xuse_cl : USE_ expanded_n ...expanded_n.. ';'; 

X 

X 

X/* 8.5 */ 

X/* idents in the following rule must contain only one identifier */ 

Xrenaming_d : 

X idents ':' ty_mk RENAMES_ name ';' | 

X idents ':' EXCEPTION_ RENAMES_ expanded_n ';' | 

X PACKAGE_ identifier RENAMES_ expanded_n ';' | 

X subprg_spec RENAMES_ name ';'; 

X 

X 

X/* 9.1 */ 

Xtask_d : task_spec ';'; 

X 

Xtask_spec : 

X TASK_ .TYPE. identifier 

X .IS..ent_d_..rep_cl_END.sim_n.; 

X 

Xtask_body : 

X TASK_ BODY_ sim_n IS_ 

X   .decl_part. 

X BEGIN_ 

X   seq_of_stmts 

X .EXCEPTION__excptn_handler..excptn_handler... 

X END_ .sim_n. ';'; 

X 

X 

X/* 9.5 */ 

Xent_d : 

X ENTRY_ identifier .fml_part. ';' | 

X ENTRY_ identifier '(' dscr_rng ')' .fml_part. ';'; 

X 

Xent_call_stmt : ..prag.. name ';'; 

X 

Xaccept_stmt : 

X ACCEPT_ sim_n .Pent_idx_P..fml_part. 

X   .DO__seq_of_stmts__END.sim_n.. ';'; 

X 

Xent_idx : expr; 

X 

X 

X/* 9.6 */ 

Xdelay_stmt : DELAY_ sim_expr ';'; 

X 

X 

X/* 9.7 */ 

Xselect_stmt : 

X selec_wait | 

X condal_ent_call | 

X timed_ent_call; 

X 

X 

X/* 9.7.1 */ 

Xselec_wait : 

X SELECT_ 

X   select_alt 

X ..OR__select_alt.. 

X .ELSE__seq_of_stmts. 

X END_ SELECT_ ';'; 

X 

Xselect_alt : 

X .WHEN__condARROW.selec_wait_alt; 

X 

Xselec_wait_alt : 

X accept_alt | 

X delay_alt | 

X terminate_alt; 

X 

Xaccept_alt : accept_stmt.seq_of_stmts.; 

X 

Xdelay_alt : delay_stmt.seq_of_stmts.; 

X 

Xterminate_alt : TERM_stmt; 

X 

X 

X/* 9.7.2 */ 

Xcondal_ent_call : 

X SELECT_ 

X   ent_call_stmt 

X   .seq_of_stmts. 

X ELSE_ 

X   seq_of_stmts 

X END_ SELECT_ ';'; 

X 

X 

X/* 9.7.3 */ 

Xtimed_ent_call : 

X SELECT_ 

X   ent_call_stmt 

X   .seq_of_stmts. 

X OR_ 

X   delay_alt 

X END_ SELECT_ ';'; 

X 

X 

X/* 9.10 */ 

Xabort_stmt : ABORT_ name ...name.. ';'; 

X 

X 

X/* 10.1 */ 

Xcompilation : ..compilation_unit..; 

X 

Xcompilation_unit : 

X context_cl library_unit | 

X context_cl secondary_unit; 

X 

Xlibrary_unit : 

X subprg_d | 

X pkg_d | 

X gen_d | 

X gen_inst | 

X subprg_body; 

X 

Xsecondary_unit : 

X library_unit_body | 

X subunit; 

X 

Xlibrary_unit_body : pkg_body_or_subprg_body; 

X 

X 

X/* 10.1.1 */ 

Xcontext_cl : ..with_cl..use_cl....; 

X 

Xwith_cl : WITH_ sim_n ...sim_n.. ';'; 

X 

X 

X/* 10.2 */ 

Xbody_stub : 

X subprg_spec IS_ SEPARATE_ ';' | 

X PACKAGE_ BODY_ sim_n IS_ SEPARATE_ ';' | 

X TASK_ BODY_ sim_n IS_ SEPARATE_ ';'; 

X 

Xsubunit : SEPARATE_ '(' expanded_n ')' proper_body; 

X 

X 

X/* 11.1 */ 

Xexcptn_d : idents ':' EXCEPTION_ ';'; 

X 

X 

X/* 11.2 */ 

Xexcptn_handler : 

X WHEN_ excptn_choice ..or_excptn_choice.. ARROW_ 

X   seq_of_stmts; 

X 

Xexcptn_choice : 

X expanded_n | 

X OTHERS_ ; 

X 

X 

X/* 11.3 */ 

Xraise_stmt : RAISE_ .expanded_n. ';'; 

X 

X 

X/* 12.1 */ 

Xgen_d : gen_spec ';'; 

X 

Xgen_spec : 

X gen_fml_part subprg_spec | 

X gen_fml_part pkg_spec; 

X 

Xgen_fml_part : GENERIC_ ..gen_prm_d..; 

X 

Xgen_prm_d : 

X idents ':' .IN.OUT.. ty_mk ._ASN_expr. ';' | 

X TYPE_ identifier IS_ gen_ty_def ';' | 

X priv_ty_d | 

X WITH_ subprg_spec .IS_BOX_. ';'; 

X/* 

X * this rule is included in the previous one 

X * WITH_ subprg_spec .IS_ name. ';' 

X */ 

X 

Xgen_ty_def : 

X '(' BOX_ ')' | 

X RANGE_ BOX_ | 

X DIGITS_ BOX_ | 

X DELTA_ BOX_ | 

X array_ty_def | 

X access_ty_def; 

X 

X 

X/* 12.3 */ 

Xgen_inst : 

X PACKAGE_ identifier IS_ NEW_ expanded_n .gen_act_part. ';' | 

X PROCEDURE__ident__IS_ NEW_ expanded_n .gen_act_part. ';' | 

X FUNCTION_ designator IS_ NEW_ expanded_n .gen_act_part. ';'; 

X 

Xgen_act_part : '(' gen_asc ...gen_asc.. ')'; 

X 

Xgen_asc : .gen_fml_prmARROW.gen_act_prm; 

X 

Xgen_fml_prm : 

X sim_n | 

X op_symbol; 

X 

Xgen_act_prm : expr_or_name_or_subprg_n_or_ent_n_or_ty_mk; 

X 

X 

X/* 13.1 */ 

Xrep_cl : 

X ty_rep_cl | 

X address_cl; 

X 

Xty_rep_cl : 

X length_cl | 

X enum_rep_cl | 

X rec_rep_cl; 

X 

X 

X/* 13.2 */ 

Xlength_cl : FOR_ attribute USE_ sim_expr ';'; 

X 

X 

X/* 13.3 */ 

Xenum_rep_cl : FOR__ty_sim_n__USE_ aggr ';'; 

X 

X 

X/* 13.4 */ 

Xrec_rep_cl : 

X FOR__ty_sim_n__USE_ RECORD_ .algt_cl. 

X   ..cmpon_cl.. 

X END_ RECORD_ ';'; 

X 

Xalgt_cl : AT_ MOD_ sim_expr ';'; 

X 

Xcmpon_cl : name AT_ sim_expr RANGE_ rng ';'; 

X 

X 

X/* 13.5 */ 

Xaddress_cl : FOR_ sim_n USE_ AT_ sim_expr ';'; 

X 

X 

X/* 13.8 */ 

Xcode_stmt : ty_mk_rec_aggr ';'; 

X 

X 

X/* 

X * The following rules define semantically qualified symbols under more 

X * general categories. 

X * 

X * ty_n_or_subty_n : expanded_n; 

X * 

X * An expanded_n is used for names that can be written using only selectors 

. 

X * 

X * ... these have been replaced logically to reduce the number of YACC_ 

X * nonterminal "rules". 

X * 

X * The following rules expand the concatenated constructs and define the 

X * specially added syntactical classes. 

X */ 

X 

X 

X/* 2.1 */ 

X..prag.. : 

X /* empty */ | 

X ..prag.. prag; 

X 

X.arg_ascs : 

X /* empty */ | 

X '(' arg_ascs ')'; 

X 

Xarg_ascs : 

X arg_asc | 

X arg_ascs ',' arg_asc; 

X 

X/* name is included under expr */ 

X 

X 

X/* 3.1 */ 

X 

X/* defer_const_d is included under object_d */ 

X 

X._ASN_expr. : 

X /* empty */ | 

X ASSIGN_ expr; 

X 

X...ident.. : 

X /* empty */ | 

X ...ident.. ',' identifier; 

X 

X.constrt. : 

X /* empty */ | 

X constrt; 

X 

X/* idx_cg and discr_c are included under aggr */ 

X 

Xexpanded_n : 

X identifier | 

X expanded_n '.' identifier; 

X 

X/* 

X * This expansion generalizes rng so that it may include ty and 

X * subty names. 

X */ 

X 

X...enum_lit_spec.. : 

X /* empty */ | 

X ...enum_lit_spec.. ',' enum_lit_spec; 

X.rng_c. : 

X /* empty */ | 

X rng_c; 

X 

X/* To avoid conflicts, the more general class name is used. */ 

X...idx_subty_def.. : 

X /* empty */ | 

X ...idx_subty_def.. ',' idx_subty_def; 

X 

X/* A_ dscr subty ind given as a ty mk is included under rng */ 

X...dscr_rng.. : 

X /* empty */ | 

X ...dscr_rng.. ',' dscr_rng; 

X 

X..cmpon_d.. : 

X /* empty */ | 

X ..cmpon_d.. cmpon_d ..prag..; 

X 

X...discr_spec.. : 

X /* empty */ | 

X ...discr_spec.. ';' discr_spec; 

X 

X/* 

X * Pragmas that can appear between two consecutive variants are 

X * picked up in the cmpons part of the variants themselves. 

X */ 

X 

X..variant.. : 

X /* empty */ | 

X ..variant.. variant; 

X 

X..or_choice.. : 

X /* empty */ | 

X ..or_choice.. '|' choice; 

X 

X/* 

X * The sim_expr by itself may be a dscr_rng or a "cmpon_sim_n". 

X * 

X * A_ body is the only later_decl_item that is not also a 

X * basic_decl_item. It is therefore used as the dividing 

X * point between the two lists of decl items. 

⌨️ 快捷键说明

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