Last active
December 23, 2015 06:08
-
-
Save m-ou-se/6591408 to your computer and use it in GitHub Desktop.
C++ parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int const * a = nullptr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
translation_unit { | |
declarations = declarations 1 { | |
declaration block_declaration simple_declaration { | |
attribute_specifiers = attribute_specifiers 0 { | |
}; | |
decl_specifier_seq = decl_specifier_seq { | |
decl_specifier = decl_specifier type_specifier trailing_type_specifier simple_type_specifier simple_type_specifier_keyword { | |
keyword = "int"; | |
}; | |
decl_specifiers = decl_specifiers 1 { | |
decl_specifier type_specifier trailing_type_specifier cv_qualifier { | |
cv = "const"; | |
}; | |
}; | |
attribute_specifiers = attribute_specifiers 0 { | |
}; | |
}; | |
init_declarator_list = init_declarator_list { | |
init_declarator = init_declarator { | |
declarator = declarator ptr_declarator { | |
ptr_operators = ptr_operators 1 { | |
ptr_operator ptr_operator_star { | |
multiply = "*"; | |
attribute_specifiers = attribute_specifiers 0 { | |
}; | |
cv_qualifiers = cv_qualifiers 0 { | |
}; | |
}; | |
}; | |
noptr_declarator = noptr_declarator { | |
noptr_declarator_root = noptr_declarator_root noptr_declarator_root_no_parentheses { | |
declarator_id = declarator_id { | |
dots = (null); | |
id_expression = id_expression unqualified_id unqualified_id_identifier { | |
identifier = "a"; | |
}; | |
}; | |
attribute_specifiers = attribute_specifiers 0 { | |
}; | |
}; | |
noptr_declarator_suffixes = noptr_declarator_suffixes 0 { | |
}; | |
}; | |
}; | |
initializer = initializer brace_or_equal_initializer equal_initializer { | |
assignment = "="; | |
initializer_clause = initializer_clause assignment_initializer_clause { | |
assignment_expression = assignment_expression conditional_expression { | |
logical_or_expression = logical_or_expression { | |
logical_and_expression = logical_and_expression { | |
inclusive_or_expression = inclusive_or_expression { | |
exclusive_or_expression = exclusive_or_expression { | |
and_expression = and_expression { | |
equality_expression = equality_expression { | |
relational_expression = relational_expression { | |
shift_expression = shift_expression { | |
additive_expression = additive_expression { | |
multiplicative_expression = multiplicative_expression { | |
pm_expression = pm_expression { | |
cast_expression = cast_expression unary_expression postfix_expression { | |
postfix_root = postfix_root postfix_root_primary_expression { | |
primary_expression = primary_expression primary_expression_literal { | |
literal = "nullptr"; | |
}; | |
}; | |
postfix_suffixes = postfix_suffixes 0 { | |
}; | |
}; | |
pm_expression_suffix = pm_expression_suffix (null); | |
}; | |
multiplicative_expression_suffix = multiplicative_expression_suffix (null); | |
}; | |
additive_expression_suffix = additive_expression_suffix (null); | |
}; | |
shift_expression_suffix = shift_expression_suffix (null); | |
}; | |
relational_expression_suffix = relational_expression_suffix (null); | |
}; | |
equality_expression_suffix = equality_expression_suffix (null); | |
}; | |
and_expression_suffix = and_expression_suffix (null); | |
}; | |
exclusive_or_expression_suffix = exclusive_or_expression_suffix (null); | |
}; | |
inclusive_or_expression_suffix = inclusive_or_expression_suffix (null); | |
}; | |
logical_and_expression_suffix = logical_and_expression_suffix (null); | |
}; | |
logical_or_expression_suffix = logical_or_expression_suffix (null); | |
}; | |
conditional_expression_suffix = conditional_expression_suffix (null); | |
}; | |
}; | |
}; | |
}; | |
comma_init_declarators = comma_init_declarators 0 { | |
}; | |
}; | |
semicolon = ";"; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment