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

📄 c.gmr

📁 Draak is a multi-language, macro compiler, meaning all syntax and code generation is defined in a si
💻 GMR
字号:
#%token int_const char_const float_const id string enumeration_const

<translation_unit>     -> <external_decl> <external_decl>*

<external_decl>        -> <decl>
<external_decl>        -> <decl_spec>* <declarator> <decl>* <compound_stat>

<decl_spec>            -> <storage_class_spec>
<decl_spec>            -> <type_spec>
<decl_spec>            -> <type_qualifier>

<decl>                 -> <decl_spec> <decl_spec>* {<init_declarator_list>} ;

<storage_class_spec>   -> auto
<storage_class_spec>   -> register
<storage_class_spec>   -> static
<storage_class_spec>   -> extern
<storage_class_spec>   -> typedef

#<type_spec>            -> <typedef_name>
<type_spec>            -> void
<type_spec>            -> char
<type_spec>            -> short
<type_spec>            -> int
<type_spec>            -> long
<type_spec>            -> float
<type_spec>            -> double
<type_spec>            -> signed
<type_spec>            -> unsigned
<type_spec>            -> <struct_or_union> {<id>} \{ <struct_decl> <struct_decl>* \}
<type_spec>            -> <struct_or_union> <id>
<type_spec>            -> enum {<id>} \{ <enumerator> <enumerator_list>* \}
<type_spec>            -> enum <id>

<type_qualifier>       -> const
<type_qualifier>       -> volatile

<struct_or_union>      -> struct
<struct_or_union>      -> union

<init_declarator_list> ->	<init_declarator> <init_declarator_list>*

<init_declarator>      -> <declarator>
<init_declarator>      -> <declarator> = <initializer>

<init_declarator_list> -> , <init_declarator>

<struct_decl>          -> <spec_qualifier_list> <struct_decl> <struct_decl_list>* ;
<struct_decl_list>     -> , <struct_decl>

<spec_qualifier_list>  -> <spec_qualifier> <spec_qualifier>*
<spec_qualifier>       -> <type_spec>
<spec_qualifier>       -> <type_qualifier>

<struct_declarator>    -> <declarator>
<struct_declarator>    -> {<declarator>} : <const_exp>

<enumerator>           -> <id>
<enumerator>           -> <id> = <const_exp>
<enumerator_list>      -> , <enumerator>


<declarator>           -> {<pointer>} <direct_declarator>*

<direct_declarator>    -> <id>
<direct_declarator>    -> ( <declarator> )
<direct_declarator>    -> [ {<const_exp>} ]
<direct_declarator>    -> ( <param_type_list> )
<direct_declarator>    -> ( {<id_list>} )

<pointer>              -> <pointer_list> <pointer_list>*
<pointer_list>         -> \* <type_qualifier>*

<param_type_list>      -> <param_decl> <param_decl_list>* {<param_decl_elipse>}

<param_decl>           -> <decl_spec> <decl_spec>* <declarator>
<param_decl>           -> <decl_spec> <decl_spec>* {<abstract_declarator>}
<param_decl_elipse>    -> , ...

<id_list>              -> <id> <id_lists>
<id_lists>             -> , <id>

<initializer>          -> <assignment_exp>
<initializer>          ->  \{ <initializer> <initializer_list>* , \}
<initializer>          ->  \{ <initializer> <initializer_list>* ) \}
<initializer_list>     -> , <initializer>

<type_name>            -> <spec_qualifier_list>  {<abstract_declarator>}

<abstract_declarator>  -> <pointer>
<abstract_declarator>  -> {<pointer>} <direct_abstract_decl>

<direct_abstract_decl> -> ( <abstract_declarator> ) <direct_abstract_list>*
<direct_abstract_list> -> [ {<const_exp>} ]
<direct_abstract_list> -> ( {<param_type_list>} )

<typedef_name>         -> <id>

#<stat>                 -> <id> : <stat>
#<stat>                 -> case <const_exp> : <stat>
#<stat>                 -> default : <stat>
#<stat>                 -> {<exp>} ;
#<stat>                 -> <compound_stat>
#<stat>                 -> if ( <exp> ) <stat>
#<stat>                 -> if ( <exp> ) <stat> else <stat>
#<stat>                 -> switch ( <exp> ) <stat>
#<stat>                 -> while ( <exp> ) <stat>
#<stat>                 -> do <stat> while ( <exp> ) ;
#<stat>                 -> for ( {<exp>} ; {<exp>} ; {<exp>} ) <stat>
#<stat>                 -> goto <id> ;
#<stat>                 -> continue ;
#<stat>                 -> break ;
<stat>                 -> return {<exp>} ;

<compound_stat>        -> ` <decl>* <stat> `

<exp>                  -> <assignment_exp> <assignment_exp_list>*

<assignment_exp>       -> <assignment_exp_op>* <conditional_exp>
<assignment_exp_op>    -> <unary_exp> <assignment_operator>
<assignment_exp_list>  -> , <assignment_exp>

<assignment_operator>  -> =
<assignment_operator>  -> \*=
<assignment_operator>  -> /=
<assignment_operator>  -> %=
<assignment_operator>  -> +=
<assignment_operator>  -> -=
<assignment_operator>  -> \<\<=
<assignment_operator>  -> >>=
<assignment_operator>  -> &=
<assignment_operator>  -> ^=
<assignment_operator>  -> |=

<conditional_exp>      -> <conditional_exp_one>* <logical_or_exp>
<conditional_exp_one>  -> <logical_or_exp> ? <exp> :

<const_exp>            -> <conditional_exp>

%left '*' '/' '%'
%left '+' '-'
%left '<<' '>>'
%left '<' '>' '<=' '>='
%left '==' '!='
%left '&'
%left '^'
%left '|'
%left '&&'
%left '||'

<logical_or_exp>       -> <cast_exp> <logical_or_exp_one>*
<logical_or_exp_one>   -> <operator> <cast_exp>
<operator>             -> \*
<operator>             -> /
<operator>             -> %
<operator>             -> +
<operator>             -> -
<operator>             -> \<\<
<operator>             -> >>
<operator>             -> \<
<operator>             -> >
<operator>             -> \<=
<operator>             -> >=
<operator>             -> ==
<operator>             -> !=
<operator>             -> &
<operator>             -> ^
<operator>             -> |
<operator>             -> &&
<operator>             -> ||

<cast_exp>             ->  <cast_type>* <unary_exp>
<cast_type>            -> ( <type_name> )

<unary_exp>            -> <unary_exp_item> <unary_exp_modifier>*
			  (			%left! )*
<unary_exp>            -> <unary_operator> <cast_exp>
<unary_exp>            -> ++ <unary_exp>
<unary_exp>            -> -- <unary_exp>
<unary_exp>            -> sizeof <unary_exp>
<unary_exp>            -> sizeof ( <type_name> )
			
<unary_exp_item>       -> <id>
<unary_exp_item>       -> <int_const>
<unary_exp_item>       -> <char_const>
<unary_exp_item>       -> <float_const>
<unary_exp_item>       -> <str>
<unary_exp_item>       -> ( <exp> )

<unary_exp_modifier>   ->	[ <exp> ]
<unary_exp_modifier>   ->	( {<argument_exp_list>} )
<unary_exp_modifier>   ->	. <id>
<unary_exp_modifier>   ->	-> <id>
<unary_exp_modifier>   ->	++
<unary_exp_modifier>   ->	--

<unary_operator>       -> &
<unary_operator>       -> \*
<unary_operator>       -> +
<unary_operator>       -> -
<unary_operator>       -> ~
<unary_operator>       -> !

<argument_exp_list>    -> <assignment_exp> <argument_exp_lists>*
<argument_exp_lists>   -> , <assignment_exp>

# Misc #

<int_const>            -> <num>
<int_const>            -> $<hex>
<float_const>          -> <num>.<num>
<char_const>           -> <str>
<num>                  -> 0123456789

⌨️ 快捷键说明

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