Expression Attributes

17 views
Skip to first unread message

Hoan Nguyen

unread,
Nov 28, 2016, 11:32:37 AM11/28/16
to Andrew Lin, Rajan, Hridesh [COM S], boa-...@googlegroups.com
Hi Andrew,

I am sorry for delay in response.
My answers to your questions are inlined below.
 
Hello,
How are you? My name is Andrew and I am currently working on a project using the Boa language.

Part of my project involves retrieving the actual string of source code a statement or expression appears in, and I was wondering if you could clarify some things for me.
 
I’m a little confused by the attributes annotation, anon_declaration, expressions and generic_parameters within the Expression type. Could you please explain what is being kept in those attributes?

annotation stores the annotation or modifier (if any) of the expression.

anon_declaration stores the anonymous class declaration of a class instance creation

expressions stores all children expressions of an expression, for example left and right hand side expressions of an infix expression, i.e. a and b in a + b.

generic_parameters stores the list of type arguments (if any) of the expression, for example new <T> C () { ... }
 
Alternatively, is there any way to retrieve the source code of a statement or expression node?

Yes, you can traverse a Boa abstract syntax tree of an expression or a statement to pretty-print it. You might need to look at how Boa ASTs are created here
to do that.
 
Thank you very much in advance, and also thank you for developing the Boa mining tool!
-Andrew Lin

Reply all
Reply to author
Forward
0 new messages