Generating AST using javacc and jjtree
- From: nakuldurve@xxxxxxxxx
- Date: 22 Oct 2006 08:16:10 -0700
Hi all,
I am using javacc and jjtree to generate an AST for a C++ input file. I
have got the file parsing fine, and the generated tree is printed
below. Is there any way to extract the information about the nodes from
the tree (e.g. instead of just "logical_and_expression", see the actual
information / text about the node) ?
The AST shown below is for the program shown here (hello world). That's
why I'm not sure what or how its managed to generate the AST below with
all inclusive_or_expressions etc etc.
Thanks a lot!
Code:
int main()
{
print("Hello world");
}
Parser output:
C++ Parser Version 0.1: Reading from file Test.cpp . . .
translation_unit
external_declaration
function_definition
declaration_specifiers
builtin_type_specifier
function_declarator
function_direct_declarator
qualified_id
func_decl_def
compound_statement
statement_list
statement
expression
assignment_expression
conditional_expression
logical_or_expression
logical_and_expression
inclusive_or_expression
exclusive_or_expression
and_expression
equality_expression
relational_expression
shift_expression
additive_expression
multiplicative_expression
pm_expression
cast_expression
unary_expression
postfix_expression
primary_expression
id_expression
expression_list
assignment_expression
conditional_expression
logical_or_expression
logical_and_expression
inclusive_or_expression
exclusive_or_expression
and_expression
equality_expression
relational_expression
shift_expression
additive_expression
multiplicative_expression
pm_expression
cast_expression
unary_expression
postfix_expression
primary_expression
C++ Parser Version 0.1: Program parsed successfully.
.
- Follow-Ups:
- Re: Generating AST using javacc and jjtree
- From: Vitaly
- Re: Generating AST using javacc and jjtree
- Prev by Date: Re: Problem installing Netbeans 5.0 on Windows XP Pro
- Next by Date: jaxb newbie | need help with a problem
- Previous by thread: Problem installing Netbeans 5.0 on Windows XP Pro
- Next by thread: Re: Generating AST using javacc and jjtree
- Index(es):
Relevant Pages
|