Skip to content

Instantly share code, notes, and snippets.

@m-ou-se
Created September 17, 2013 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-ou-se/6591891 to your computer and use it in GitHub Desktop.
Save m-ou-se/6591891 to your computer and use it in GitHub Desktop.
C++ grammar
= translation_unit
declarations
* declarations
declaration
| primary_expression
primary_expression_literal
primary_expression_this
expression_in_parentheses
id_expression
lambda_expression
= primary_expression_literal
LITERAL
= primary_expression_this
KEYWORD this_
= expression_in_parentheses
OPERATOR left_parentheses
expression
OPERATOR right_parentheses
| type_name
class_name
enum_name
typedef_name
| class_name
class_name_identifier
class_name_template
= class_name_template
IDENTIFIER TC
template_name_suffix
= template_name_suffix
OPERATOR less
? template_argument_list
close_angle_bracket
= class_name_identifier
IDENTIFIER C
= enum_name
IDENTIFIER E
= namespace_name
IDENTIFIER N
= typedef_name
IDENTIFIER Y
= simple_template_id
IDENTIFIER T
OPERATOR less
? template_argument_list
close_angle_bracket
| id_expression
qualified_id
unqualified_id
| unqualified_id
unqualified_id_identifier
operator_function_id
conversion_function_id
literal_operator_id
unqualified_id_compl_class
unqualified_id_compl_decltype
template_id
= unqualified_id_identifier
IDENTIFIER
= unqualified_id_compl_class
OPERATOR complement
class_name
= unqualified_id_compl_decltype
OPERATOR complement
decltype_specifier
= qualified_id
nested_name_specifier
? KEYWORD template_
unqualified_id
= nested_name_specifier
nested_name_specifier_root
nested_name_specifier_suffixes
* nested_name_specifier_suffixes
nested_name_specifier_suffix
| nested_name_specifier_root
nested_name_specifier_root_empty
nested_name_specifier_root_type
nested_name_specifier_root_namespace
nested_name_specifier_root_decltype
= nested_name_specifier_root_empty
OPERATOR colons
= nested_name_specifier_root_type
type_name
OPERATOR colons
= nested_name_specifier_root_namespace
namespace_name
OPERATOR colons
= nested_name_specifier_root_decltype
decltype_specifier
OPERATOR colons
| nested_name_specifier_suffix
nested_name_specifier_suffix_identifier
nested_name_specifier_suffix_template
= nested_name_specifier_suffix_identifier
IDENTIFIER
OPERATOR colons
= nested_name_specifier_suffix_template
? KEYWORD template_
simple_template_id
OPERATOR colons
= lambda_expression
lambda_introducer
? lambda_declarator
compound_statement
= lambda_introducer
OPERATOR left_square_bracket
? lambda_capture
OPERATOR right_square_bracket
| lambda_capture
capture_default
capture_list
capture_default_comma_list
= capture_default_comma_list
capture_default
OPERATOR comma
capture_list
| capture_default
capture_default_reference
capture_default_copy
= capture_default_reference
OPERATOR bit_and
= capture_default_copy
OPERATOR assignment
= capture_list
capture
? OPERATOR dots
comma_captures
* comma_captures
comma_capture
= comma_capture
OPERATOR comma
capture
? OPERATOR dots
| capture
capture_copy
capture_reference
capture_this
= capture_copy
IDENTIFIER
= capture_reference
OPERATOR bit_and
IDENTIFIER
= capture_this
KEYWORD this_
= lambda_declarator
OPERATOR left_parentheses
parameter_declaration_clause
OPERATOR right_parentheses
? KEYWORD mutable_
? exception_specification
attribute_specifiers
? trailing_return_type
= postfix_expression
postfix_root
postfix_suffixes
* postfix_suffixes
postfix_suffix
| postfix_root
postfix_root_primary_expression
postfix_root_simple_type_specifier
postfix_root_typename_specifier
postfix_root_simple_type_braced_init
postfix_root_typename_braced_init
named_cast
postfix_root_typeid_expression
postfix_root_typeid_type
= postfix_root_primary_expression
primary_expression
= postfix_root_simple_type_specifier
simple_type_specifier
OPERATOR left_parentheses
? expression_list
OPERATOR right_parentheses
= postfix_root_typename_specifier
typename_specifier
OPERATOR left_parentheses
? expression_list
OPERATOR right_parentheses
= postfix_root_simple_type_braced_init
simple_type_specifier
braced_init_list
= postfix_root_typename_braced_init
typename_specifier
braced_init_list
| named_cast
named_dynamic_cast
named_static_cast
named_reinterpret_cast
named_const_cast
= named_dynamic_cast
KEYWORD dynamic_cast_
named_cast_suffix
= named_static_cast
KEYWORD static_cast_
named_cast_suffix
= named_reinterpret_cast
KEYWORD reinterpret_cast_
named_cast_suffix
= named_const_cast
KEYWORD const_cast_
named_cast_suffix
= named_cast_suffix
OPERATOR less
type_id
close_angle_bracket
OPERATOR left_parentheses
expression
OPERATOR right_parentheses
= postfix_root_typeid_expression
KEYWORD typeid_
OPERATOR left_parentheses
expression
OPERATOR right_parentheses
= postfix_root_typeid_type
KEYWORD typeid_
OPERATOR left_parentheses
type_id
OPERATOR right_parentheses
| postfix_suffix
postfix_suffix_subscript_expression
postfix_suffix_subscript_braces
postfix_suffix_parentheses
postfix_suffix_dot_destructor
postfix_suffix_dot_id
postfix_suffix_arrow_destructor
postfix_suffix_arrow_id
postfix_suffix_inc
postfix_suffix_dec
= postfix_suffix_subscript_expression
OPERATOR left_square_bracket
expression
OPERATOR right_square_bracket
= postfix_suffix_subscript_braces
OPERATOR left_square_bracket
braced_init_list
OPERATOR right_square_bracket
= postfix_suffix_parentheses
OPERATOR left_parentheses
? expression_list
OPERATOR right_parentheses
= postfix_suffix_dot_destructor
OPERATOR dot
pseudo_destructor_name
= postfix_suffix_dot_id
OPERATOR dot
? KEYWORD template_
id_expression
= postfix_suffix_arrow_destructor
OPERATOR arrow
pseudo_destructor_name
= postfix_suffix_arrow_id
OPERATOR arrow
? KEYWORD template_
id_expression
= postfix_suffix_inc
OPERATOR increment
= postfix_suffix_dec
OPERATOR decrement
= expression_list
initializer_list
| pseudo_destructor_name
pseudo_destructor_name_type
pseudo_destructor_name_decltype
= pseudo_destructor_name_type
? nested_name_specifier
OPERATOR complement
type_name
= pseudo_destructor_name_decltype
OPERATOR complement
decltype_specifier
| unary_expression
postfix_expression
unary_cast_expression
unary_sizeof_expression
unary_sizeof_expression_parentheses
unary_sizeof_dots
unary_alignof
noexcept_expression
new_expression
delete_expression
= unary_cast_expression
unary_operator
cast_expression
= unary_sizeof_expression
KEYWORD sizeof_
unary_expression
= unary_sizeof_expression_parentheses
KEYWORD sizeof_
OPERATOR left_parentheses
type_id
OPERATOR right_parentheses
= unary_sizeof_dots
KEYWORD sizeof_
OPERATOR dots
OPERATOR left_parentheses
IDENTIFIER
OPERATOR right_parentheses
= unary_alignof
KEYWORD alignof_
OPERATOR left_parentheses
type_id
OPERATOR right_parentheses
= unary_operator
OPERATOR operator_ increment decrement multiply bit_and plus minus logical_not complement
| new_expression
new_expression_type
new_expression_normal
= new_expression_normal
? OPERATOR colons
OPERATOR new_
? new_placement
new_type_id
? new_initializer
= new_expression_type
? OPERATOR colons
OPERATOR new_
? new_placement
OPERATOR left_parentheses
type_id
OPERATOR right_parentheses
? new_initializer
= new_placement
OPERATOR left_parentheses
expression_list
OPERATOR right_parentheses
= new_type_id
type_specifier_seq
? new_declarator
| new_declarator
new_declarator_noptr
new_declarator_ptr
= new_declarator_noptr
ptr_operators
noptr_new_declarator
= new_declarator_ptr
ptr_operator
ptr_operators
= noptr_new_declarator
OPERATOR left_square_bracket
expression
OPERATOR right_square_bracket
attribute_specifiers
noptr_new_declarator_suffixes
* noptr_new_declarator_suffixes
noptr_new_declarator_suffix
= noptr_new_declarator_suffix
OPERATOR left_square_bracket
constant_expression
OPERATOR right_square_bracket
attribute_specifiers
| new_initializer
new_initializer_parentheses
new_initializer_init_list
= new_initializer_parentheses
OPERATOR left_parentheses
? expression_list
OPERATOR right_parentheses
= new_initializer_init_list
braced_init_list
| delete_expression
delete_expression_no_array
delete_expression_array
= delete_expression_no_array
? OPERATOR colons
OPERATOR delete_
cast_expression
= delete_expression_array
? OPERATOR colons
OPERATOR delete_
OPERATOR left_square_bracket
OPERATOR right_square_bracket
cast_expression
= noexcept_expression
KEYWORD noexcept_
OPERATOR left_parentheses
expression
OPERATOR right_parentheses
| cast_expression
real_cast_expression
unary_expression
= real_cast_expression
cast_operator
cast_expression
= cast_operator
OPERATOR left_parentheses
type_id
OPERATOR right_parentheses
= pm_expression
cast_expression
? pm_expression_suffix
= pm_expression_suffix
OPERATOR operator_ dot_star arrow_star
pm_expression
= multiplicative_expression
pm_expression
? multiplicative_expression_suffix
= multiplicative_expression_suffix
OPERATOR operator_ multiply divide modulo
multiplicative_expression
= additive_expression
multiplicative_expression
? additive_expression_suffix
= additive_expression_suffix
OPERATOR operator_ plus minus
additive_expression
= shift_expression
additive_expression
? shift_expression_suffix
= shift_expression_suffix
shift_operator
shift_expression
| shift_operator
left_shift_operator
right_shift_operator
= left_shift_operator
OPERATOR left_shift
= right_shift_operator
OPERATOR right_shift_1
OPERATOR right_shift_2
= relational_expression
shift_expression
? relational_expression_suffix
= relational_expression_suffix
OPERATOR operator_ less greater less_equal greater_equal
relational_expression
= equality_expression
relational_expression
? equality_expression_suffix
= equality_expression_suffix
OPERATOR operator_ equal not_equal
equality_expression
= and_expression
equality_expression
? and_expression_suffix
= and_expression_suffix
OPERATOR bit_and
and_expression
= exclusive_or_expression
and_expression
? exclusive_or_expression_suffix
= exclusive_or_expression_suffix
OPERATOR bit_xor
exclusive_or_expression
= inclusive_or_expression
exclusive_or_expression
? inclusive_or_expression_suffix
= inclusive_or_expression_suffix
OPERATOR bit_or
inclusive_or_expression
= logical_and_expression
inclusive_or_expression
? logical_and_expression_suffix
= logical_and_expression_suffix
OPERATOR logical_and
logical_and_expression
= logical_or_expression
logical_and_expression
? logical_or_expression_suffix
= logical_or_expression_suffix
OPERATOR logical_or
logical_or_expression
= conditional_expression
logical_or_expression
? conditional_expression_suffix
= conditional_expression_suffix
OPERATOR question
expression
OPERATOR colon
assignment_expression
| assignment_expression
real_assignment_expression
conditional_expression
throw_expression
= real_assignment_expression
logical_or_expression
OPERATOR operator_ assignment multiply_assignment divide_assignment modulo_assignment plus_assignment minus_assignment right_shift_assignment left_shift_assignment and_assignment xor_assignment or_assignment
initializer_clause
| comma_expression
real_comma_expression
assignment_expression
= real_comma_expression
assignment_expression
OPERATOR comma
comma_expression
| expression
comma_expression
= constant_expression
conditional_expression
| statement
attribute_statement
declaration_statement
= attribute_statement
attribute_specifiers
attribute_statement_suffix
| attribute_statement_suffix
labeled_statement
expression_statement
compound_statement
selection_statement
iteration_statement
jump_statement
try_block
| labeled_statement
label_statement
case_statement
default_statement
= label_statement
IDENTIFIER
OPERATOR colon
statement
= case_statement
KEYWORD case_
constant_expression
OPERATOR colon
statement
= default_statement
KEYWORD default_
OPERATOR colon
statement
= expression_statement
? expression
OPERATOR semicolon
= compound_statement
OPERATOR left_brace
statements
OPERATOR right_brace
* statements
statement
| selection_statement
if_statement
switch_statement
= if_statement
KEYWORD if_
OPERATOR left_parentheses
condition
OPERATOR right_parentheses
statement
? else_statement
= else_statement
KEYWORD else_
statement
= switch_statement
KEYWORD switch_
OPERATOR left_parentheses
condition
OPERATOR right_parentheses
statement
= condition_declaration
attribute_specifiers
decl_specifier_seq
declarator
condition_declaration_suffix
| condition_declaration_suffix
condition_declaration_suffix_assignment
condition_declaration_suffix_init_list
= condition_declaration_suffix_assignment
OPERATOR assignment
initializer_clause
= condition_declaration_suffix_init_list
braced_init_list
| condition
condition_declaration
expression
| iteration_statement
while_statement
do_statement
for_statement
range_for_statement
= while_statement
KEYWORD while_
OPERATOR left_parentheses
condition
OPERATOR right_parentheses
statement
= do_statement
KEYWORD do_
statement
KEYWORD while_
OPERATOR left_parentheses
expression
OPERATOR right_parentheses
OPERATOR semicolon
= for_statement
KEYWORD for_
OPERATOR left_parentheses
for_init_statement
? condition
OPERATOR semicolon
? expression
OPERATOR right_parentheses
statement
= range_for_statement
KEYWORD for_
OPERATOR left_parentheses
for_range_declaration
OPERATOR colon
for_range_initializer
OPERATOR right_parentheses
statement
| for_init_statement
for_init_statement_expression
for_init_statement_declaration
= for_init_statement_expression
expression_statement
= for_init_statement_declaration
simple_declaration
= for_range_declaration
attribute_specifiers
decl_specifier_seq
declarator
| for_range_initializer
for_range_initializer_expression
for_range_initializer_init_list
= for_range_initializer_expression
expression
= for_range_initializer_init_list
braced_init_list
| jump_statement
break_statement
continue_statement
return_statement
goto_statement
= break_statement
KEYWORD break_
OPERATOR semicolon
= continue_statement
KEYWORD continue_
OPERATOR semicolon
= return_statement
KEYWORD return_
? return_statement_value
OPERATOR semicolon
| return_statement_value
return_statement_expression
return_statement_init_list
= return_statement_expression
expression
= return_statement_init_list
braced_init_list
= goto_statement
KEYWORD goto_
IDENTIFIER
OPERATOR semicolon
= declaration_statement
block_declaration
| declaration
block_declaration
function_definition
template_declaration
explicit_instantiation
explicit_specialization
linkage_specification
namespace_definition
empty_declaration
attribute_declaration
| block_declaration
simple_declaration
asm_definition
namespace_alias_definition
using_declaration
using_directive
static_assert_declaration
alias_declaration
opaque_enum_declaration
= alias_declaration
KEYWORD using_
IDENTIFIER
attribute_specifiers
OPERATOR assignment
type_id
OPERATOR semicolon
* attribute_specifiers
attribute_specifier
= simple_declaration
attribute_specifiers
decl_specifier_seq
? init_declarator_list
OPERATOR semicolon
= static_assert_declaration
KEYWORD static_assert_
OPERATOR left_parentheses
constant_expression
OPERATOR comma
LITERAL
OPERATOR right_parentheses
OPERATOR semicolon
= empty_declaration
OPERATOR semicolon
= attribute_declaration
attribute_specifier
attribute_specifiers
OPERATOR semicolon
| decl_specifier
storage_class_specifier
type_specifier
function_specifier
decl_specifier_keyword
= decl_specifier_keyword
KEYWORD keyword friend_ typedef_ constexpr_
= decl_specifier_seq
decl_specifier
decl_specifiers
attribute_specifiers
* decl_specifiers
decl_specifier
= storage_class_specifier
KEYWORD keyword register_ static_ thread_local_ extern_ mutable_
= function_specifier
KEYWORD keyword inline_ virtual_ explicit_
| type_specifier
trailing_type_specifier
class_specifier
enum_specifier
| trailing_type_specifier
simple_type_specifier
elaborated_type_specifier
typename_specifier
cv_qualifier
= type_specifier_seq
type_specifier
type_specifiers
attribute_specifiers
* type_specifiers
type_specifier
= trailing_type_specifier_seq
trailing_type_specifier
trailing_type_specifiers
attribute_specifiers
* trailing_type_specifiers
trailing_type_specifier
| simple_type_specifier
simple_type_specifier_keyword
simple_type_specifier_type
simple_type_specifier_template
simple_type_decltype
= simple_type_decltype
decltype_specifier
= simple_type_specifier_type
? nested_name_specifier
type_name
= simple_type_specifier_template
nested_name_specifier
KEYWORD template_
simple_template_id
= simple_type_specifier_keyword
KEYWORD keyword char_ char16_t_ char32_t_ wchar_t_ bool_ short_ int_ long_ signed_ unsigned_ float_ double_ void_ auto_
= decltype_specifier
KEYWORD decltype_
OPERATOR left_parentheses
expression
OPERATOR right_parentheses
| elaborated_type_specifier
elaborated_type_specifier_identifier
elaborated_type_specifier_template
elaborated_type_specifier_enum
= elaborated_type_specifier_identifier
class_key
attribute_specifiers
? nested_name_specifier
IDENTIFIER
= elaborated_type_specifier_template
class_key
? nested_name_specifier
? KEYWORD template_
simple_template_id
= elaborated_type_specifier_enum
KEYWORD enum_
? nested_name_specifier
IDENTIFIER
= enum_specifier
enum_key
attribute_specifiers
? enum_specifier_name
? enum_base
OPERATOR left_brace
? enumerator_list
OPERATOR right_brace
= enum_specifier_name
? nested_name_specifier
IDENTIFIER
= enumerator_list
enumerator_definition
comma_enumerator_definitions
? OPERATOR comma
* comma_enumerator_definitions
comma_enumerator_definition
= comma_enumerator_definition
OPERATOR comma
enumerator_definition
= opaque_enum_declaration
enum_key
attribute_specifiers
IDENTIFIER
? enum_base
OPERATOR semicolon
= enum_key
KEYWORD enum_
? KEYWORD class_or_struct class_ struct_
= enum_base
OPERATOR colon
type_specifier_seq
= enumerator_definition
enumerator
? enumerator_assignment
= enumerator_assignment
OPERATOR assignment
constant_expression
= enumerator
IDENTIFIER
= namespace_definition
? KEYWORD inline_
KEYWORD namespace_
? IDENTIFIER
OPERATOR left_brace
namespace_body
OPERATOR right_brace
= namespace_body
declarations
= namespace_alias_definition
KEYWORD namespace_
IDENTIFIER
OPERATOR assignment
qualified_namespace_specifier
OPERATOR semicolon
= qualified_namespace_specifier
? nested_name_specifier
namespace_name
| using_declaration
using_declaration_non_root
using_declaration_root
= using_declaration_non_root
KEYWORD using_
? KEYWORD template_
nested_name_specifier
unqualified_id
OPERATOR semicolon
= using_declaration_root
KEYWORD using_
OPERATOR colons
unqualified_id
OPERATOR semicolon
= using_directive
attribute_specifiers
KEYWORD using_
KEYWORD namespace_
? nested_name_specifier
IDENTIFIER
OPERATOR semicolon
= asm_definition
KEYWORD asm_
OPERATOR left_parentheses
LITERAL
OPERATOR right_parentheses
OPERATOR semicolon
| linkage_specification
linkage_specification_braces
linkage_specification_no_braces
= linkage_specification_braces
KEYWORD extern_
STRING_LITERAL
OPERATOR left_brace
declarations
OPERATOR right_brace
= linkage_specification_no_braces
KEYWORD extern_
STRING_LITERAL
declaration
| attribute_specifier
normal_attribute_specifier
alignment_specifier
= normal_attribute_specifier
OPERATOR left1 left_square_bracket
OPERATOR left2 left_square_bracket
attribute_list
OPERATOR right1 right_square_bracket
OPERATOR right2 right_square_bracket
| alignment_specifier
alignment_specifier_type
alignment_specifier_expression
= alignment_specifier_type
KEYWORD alignas_
OPERATOR left_parentheses
type_id
? OPERATOR dots
OPERATOR right_parentheses
= alignment_specifier_expression
KEYWORD alignas_
OPERATOR left_parentheses
assignment_expression
? OPERATOR dots
OPERATOR right_parentheses
= attribute_list
? attribute_dots
comma_attributes
* comma_attributes
comma_attribute
= comma_attribute
OPERATOR comma
? attribute_dots
= attribute_dots
attribute
? OPERATOR dots
= attribute
attribute_token
? attribute_argument_clause
| attribute_token
attribute_identifier_token
attribute_scoped_token
= attribute_identifier_token
IDENTIFIER
= attribute_scoped_token
attribute_namespace
OPERATOR colons
IDENTIFIER
= attribute_namespace
IDENTIFIER
= attribute_argument_clause
OPERATOR left_parentheses
balanced_tokens
OPERATOR right_parentheses
* balanced_tokens
balanced_token
| balanced_token
balanced_parentheses
balanced_square_brackets
balanced_braces
balanced_other
= balanced_parentheses
OPERATOR left_parentheses
balanced_tokens
OPERATOR right_parentheses
= balanced_square_brackets
OPERATOR left_square_bracket
balanced_tokens
OPERATOR right_square_bracket
= balanced_braces
OPERATOR left_brace
balanced_tokens
OPERATOR right_brace
= balanced_other
NONPAREN
= init_declarator_list
init_declarator
comma_init_declarators
* comma_init_declarators
comma_init_declarator
= comma_init_declarator
OPERATOR comma
init_declarator
= init_declarator
declarator
? initializer
| declarator
trailing_return_type_declarator
ptr_declarator
= trailing_return_type_declarator
noptr_declarator
trailing_return_type
= ptr_declarator
ptr_operators
noptr_declarator
* ptr_operators
ptr_operator
= noptr_declarator
noptr_declarator_root
noptr_declarator_suffixes
* noptr_declarator_suffixes
noptr_declarator_suffix
| noptr_declarator_root
noptr_declarator_root_no_parentheses
noptr_declarator_root_parentheses
= noptr_declarator_root_no_parentheses
declarator_id
attribute_specifiers
= noptr_declarator_root_parentheses
OPERATOR left_parentheses
ptr_declarator
OPERATOR right_parentheses
| noptr_declarator_suffix
parameters_and_qualifiers
noptr_declarator_suffix_square_brackets
= noptr_declarator_suffix_square_brackets
OPERATOR left_square_bracket
? constant_expression
OPERATOR right_square_bracket
attribute_specifiers
= parameters_and_qualifiers
OPERATOR left_parentheses
parameter_declaration_clause
OPERATOR right_parentheses
cv_qualifiers
? ref_qualifier
? exception_specification
attribute_specifiers
* cv_qualifiers
cv_qualifier
= trailing_return_type
OPERATOR arrow
trailing_type_specifier_seq
? abstract_declarator
| ptr_operator
ptr_operator_star
ptr_operator_amp
ptr_operator_amp_amp
ptr_operator_name
= ptr_operator_star
OPERATOR multiply
attribute_specifiers
cv_qualifiers
= ptr_operator_amp
OPERATOR bit_and
attribute_specifiers
= ptr_operator_amp_amp
OPERATOR logical_and
attribute_specifiers
= ptr_operator_name
nested_name_specifier
OPERATOR multiply
attribute_specifiers
cv_qualifiers
= cv_qualifier
KEYWORD cv const_ volatile_
= ref_qualifier
OPERATOR operator_ bit_and logical_and
= declarator_id
? OPERATOR dots
id_expression
= type_id
type_specifier_seq
? abstract_declarator
| abstract_declarator
ptr_abstract_declarator
trailing_return_type_abstract_declarator
abstract_pack_declarator
= trailing_return_type_abstract_declarator
? noptr_abstract_declarator
trailing_return_type
| ptr_abstract_declarator
ptr_abstract_declarator_no_ptr
ptr_abstract_declarator_ptr
= ptr_abstract_declarator_no_ptr
ptr_operators
noptr_abstract_declarator
= ptr_abstract_declarator_ptr
ptr_operator
ptr_operators
= noptr_abstract_declarator
noptr_abstract_declarator_root
noptr_declarator_suffixes
| noptr_abstract_declarator_root
noptr_declarator_suffix
noptr_abstract_declarator_root_parentheses
= noptr_abstract_declarator_root_parentheses
OPERATOR left_parentheses
ptr_abstract_declarator
OPERATOR right_parentheses
= abstract_pack_declarator
ptr_operators
noptr_abstract_pack_declarator
| noptr_abstract_pack_declarator
noptr_abstract_pack_declarator_dots
noptr_declarator_suffixes
= noptr_abstract_pack_declarator_dots
OPERATOR dots
| parameter_declaration_clause
parameter_declaration_clause_comma
parameter_declaration_clause_no_comma
= parameter_declaration_clause_comma
parameter_declaration_list
OPERATOR comma
OPERATOR dots
= parameter_declaration_clause_no_comma
? parameter_declaration_list
? OPERATOR dots
= parameter_declaration_list
parameter_declaration
comma_parameter_declarations
* comma_parameter_declarations
comma_parameter_declaration
= comma_parameter_declaration
OPERATOR comma
parameter_declaration
= parameter_declaration
attribute_specifiers
decl_specifier_seq
? possibly_abstract_declarator
? equal_initializer
= function_definition
attribute_specifiers
decl_specifier_seq
declarator
virt_specifiers
function_body
* virt_specifiers
virt_specifier
| function_body
funciton_body_normal
function_try_block
function_body_default
function_body_delete
= funciton_body_normal
? ctor_initializer
compound_statement
= function_body_default
OPERATOR assignment
KEYWORD default_
OPERATOR semicolon
= function_body_delete
OPERATOR assignment
OPERATOR delete_
OPERATOR semicolon
| initializer
brace_or_equal_initializer
parentheses_initializer
= parentheses_initializer
OPERATOR left_parentheses
expression_list
OPERATOR right_parentheses
| brace_or_equal_initializer
braced_init_list
equal_initializer
= equal_initializer
OPERATOR assignment
initializer_clause
| initializer_clause
assignment_initializer_clause
braced_initializer_clause
= assignment_initializer_clause
assignment_expression
= braced_initializer_clause
braced_init_list
= initializer_list
initializer_clause_dots
comma_initializer_clauses
* comma_initializer_clauses
comma_initializer_clause
= comma_initializer_clause
OPERATOR comma
initializer_clause_dots
= initializer_clause_dots
initializer_clause
? OPERATOR dots
| braced_init_list
braced_init_list_empty
braced_init_list_not_empty
= braced_init_list_not_empty
OPERATOR left_brace
initializer_list
? OPERATOR comma
OPERATOR right_brace
= braced_init_list_empty
OPERATOR left_brace
OPERATOR right_brace
= class_specifier
class_head
OPERATOR left_brace
member_specifications
OPERATOR right_brace
* member_specifications
member_specification
= class_head
class_key
attribute_specifiers
? class_head_name_virt
? base_clause
= class_head_name_virt
class_head_name
? class_virt_specifier
= class_head_name
? nested_name_specifier
class_name
= class_virt_specifier
SPECIFIC_IDENTIFIER final
= class_key
KEYWORD keyword class_ struct_ union_
| member_specification
member_declaration
access_specifier_colon
= access_specifier_colon
access_specifier
OPERATOR colon
| member_declaration
member_declaration_list
member_function_definition
member_using_declaration
member_static_assert_declaration
member_template_declaration
member_alias_declaration
= member_declaration_list
attribute_specifiers
decl_specifier_seq
? member_declarator_list
OPERATOR semicolon
= member_function_definition
function_definition
? OPERATOR semicolon
= member_using_declaration
using_declaration
= member_static_assert_declaration
static_assert_declaration
= member_template_declaration
template_declaration
= member_alias_declaration
alias_declaration
= member_declarator_list
member_declarator
comma_member_declarators
* comma_member_declarators
comma_member_declarator
= comma_member_declarator
OPERATOR comma
member_declarator
| member_declarator
member_declarator_normal
member_declarator_initializer
member_declarator_expression
= member_declarator_normal
declarator
virt_specifiers
? pure_specifier
= member_declarator_initializer
declarator
brace_or_equal_initializer
= member_declarator_expression
? IDENTIFIER
attribute_specifiers
OPERATOR colon
constant_expression
= virt_specifier
SPECIFIC_IDENTIFIER identifier override final
= pure_specifier
OPERATOR assignment
ZERO
= base_clause
OPERATOR colon
base_specifier_list
= base_specifier_list
base_specifier_dots
comma_base_specifiers
* comma_base_specifiers
comma_base_specifier
= comma_base_specifier
OPERATOR comma
base_specifier_dots
= base_specifier_dots
base_specifier
? OPERATOR dots
= base_specifier
attribute_specifiers
? base_access_specifier
base_type_specifier
| base_access_specifier
base_access_specifier_1
base_access_specifier_2
= base_access_specifier_1
KEYWORD virtual_
? access_specifier
= base_access_specifier_2
access_specifier
? KEYWORD virtual_
| class_or_decltype
class_no_decltype
decltype_specifier
= class_no_decltype
? nested_name_specifier
class_name
| base_type_specifier
class_or_decltype
= access_specifier
KEYWORD keyword_ private_ protected_ public_
= conversion_function_id
KEYWORD operator_
conversion_type_id
= conversion_type_id
type_specifier_seq
ptr_operators
= ctor_initializer
OPERATOR colon
mem_initializer_list
= mem_initializer_list
mem_initializer_dots
comma_mem_initializers
* comma_mem_initializers
comma_mem_initializer
= comma_mem_initializer
OPERATOR comma
mem_initializer_dots
= mem_initializer_dots
mem_initializer
? OPERATOR dots
| mem_initializer
mem_initializer_parentheses
mem_initializer_init_list
= mem_initializer_parentheses
mem_initializer_id
OPERATOR left_parentheses
? expression_list
OPERATOR right_parentheses
= mem_initializer_init_list
mem_initializer_id
braced_init_list
| mem_initializer_id
base_type_specifier
mem_initializer_id_idetifier
= mem_initializer_id_idetifier
IDENTIFIER
= operator_function_id
KEYWORD operator_
operator_function_id_operator
| operator_function_id_operator
operator_function_id_operator_array_new
operator_function_id_operator_array_delete
operator_function_id_operator_parentheses
operator_function_id_operator_square_brackets
operator_function_id_operator_right_shift
operator_function_id_operator_single_operator
= operator_function_id_operator_parentheses
OPERATOR left_parentheses
OPERATOR right_parentheses
= operator_function_id_operator_square_brackets
OPERATOR left_square_bracket
OPERATOR right_square_bracket
= operator_function_id_operator_right_shift
OPERATOR right_shift_1
OPERATOR right_shift_2
= operator_function_id_operator_array_new
OPERATOR new_
OPERATOR left_square_bracket
OPERATOR right_square_bracket
= operator_function_id_operator_array_delete
OPERATOR delete_
OPERATOR left_square_bracket
OPERATOR right_square_bracket
= operator_function_id_operator_single_operator
OPERATOR operator_ new_ delete_ plus minus multiply divide modulo bit_xor bit_or bit_and complement logical_not assignment less greater plus_assignment minus_assignment multiply_assignment divide_assignment modulo_assignment xor_assignment and_assignment or_assignment left_shift equal not_equal less_equal greater_equal logical_and logical_or increment decrement comma arrow_star arrow
= literal_operator_id
KEYWORD operator_
EMPTY_STRING
IDENTIFIER
= template_declaration
KEYWORD template_
OPERATOR less
template_parameter_list
close_angle_bracket
declaration
= template_parameter_list
template_parameter
comma_template_parameters
* comma_template_parameters
comma_template_parameter
= comma_template_parameter
OPERATOR comma
template_parameter
| template_parameter
type_parameter
parameter_declaration
| type_parameter
type_paramter_assign
type_paramter_no_assign
type_parameter_template
= type_paramter_no_assign
KEYWORD keyword class_ typename_
? OPERATOR dots
? IDENTIFIER
= type_paramter_assign
KEYWORD keyword class_ typename_
? IDENTIFIER
OPERATOR assignment
type_id
= type_parameter_template
KEYWORD template_
OPERATOR less
template_parameter_list
close_angle_bracket
KEYWORD class_
? type_parameter_template_suffix
| type_parameter_template_suffix
type_parameter_template_suffix_assign
type_parameter_template_suffix_no_assign
= type_parameter_template_suffix_no_assign
? OPERATOR dots
IDENTIFIER
= type_parameter_template_suffix_assign
? IDENTIFIER
OPERATOR assignment
id_expression
= close_angle_bracket
OPERATOR operator_ greater right_shift_1 right_shift_2
| template_id
simple_template_id
function_template_id
literal_operator_template_id
= function_template_id
operator_function_id
OPERATOR less
? template_argument_list
close_angle_bracket
= literal_operator_template_id
literal_operator_id
OPERATOR less
? template_argument_list
close_angle_bracket
= template_argument_list
template_argument_dots
comma_template_arguments
* comma_template_arguments
comma_template_argument
= comma_template_argument
OPERATOR comma
template_argument_dots
= template_argument_dots
template_argument
? OPERATOR dots
| template_argument
template_argument_expression
template_argument_type
template_argument_id
= template_argument_expression
constant_expression
= template_argument_type
type_id
= template_argument_id
id_expression
= typename_specifier
KEYWORD typename_
nested_name_specifier
typename_specifier_name
| typename_specifier_name
typename_specifier_identifier
typename_specifier_template
= typename_specifier_identifier
IDENTIFIER
= typename_specifier_template
? KEYWORD template_
simple_template_id
= explicit_instantiation
? KEYWORD extern_
KEYWORD template_
declaration
= explicit_specialization
KEYWORD template_
OPERATOR less
close_angle_bracket
declaration
= try_block
KEYWORD try_
compound_statement
handler
handlers
* handlers
handler
= function_try_block
KEYWORD try_
? ctor_initializer
compound_statement
handler
handlers
= handler
KEYWORD catch_
OPERATOR left_parentheses
exception_declaration
OPERATOR right_parentheses
compound_statement
| exception_declaration
exception_declaration_no_dots
exception_declaration_dots
= exception_declaration_no_dots
attribute_specifiers attribute_specifiers_1
type_specifier
type_specifiers
attribute_specifiers attribute_specifiers_2
? possibly_abstract_declarator
= exception_declaration_dots
OPERATOR dots
| possibly_abstract_declarator
declarator
abstract_declarator
= throw_expression
KEYWORD throw_
? assignment_expression
| exception_specification
dynamic_exception_specification
noexcept_specification
= dynamic_exception_specification
KEYWORD throw_
OPERATOR left_parentheses
? type_id_list
OPERATOR right_parentheses
| type_id_list
type_id_dots
comma_type_ids
* comma_type_ids
comma_type_id
= comma_type_id
OPERATOR comma
type_id_dots
= type_id_dots
type_id
? OPERATOR dots
= noexcept_specification
KEYWORD noexcept_
? noexcept_specification_suffix
= noexcept_specification_suffix
OPERATOR left_parentheses
constant_expression
OPERATOR right_parentheses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment