Re: [Jastadd] Questions on the comments in the generated .java files.

From: Jesper Öqvist <jesper.oqvist_at_cs.lth.se>
Date: Thu, 08 Dec 2011 08:51:14 +0100

Hello Hyunik,
The comments you see in the generated Java files are inserted by
JastAdd2 specifically for the RagDoll doclet (svn co
http://svn.cs.lth.se/svn/jastadd/trunk/RagDoll). The way JastAdd2 is
built restricts the information that can be provided in the generated
comments.
For some methods the placeholder filename java.ast is used as the source
file name, because the actual source file name is unavailable.

The _at_apilevel tag refers to what the attribute/method/node is used for:

* internal = used for caching of attributes, rewrite handling, or other
things which are generated by JastAdd for internal bookkeeping and not
ment to be used directly by the programmer
* low-level = may be used by an expert JastAdd user to avoid rewrites
while traversing the tree etc. (GetChildNoTransform et. al.)
* high-level = user-defined attributes and common tree traversing
methods such as GetChild

If you generate documentation using RagDoll you will notice that
internal and lowl-level stuff is per default hidden.

You can see an example of the generated documentation at http://doc.llbit.se

/Jesper

On 12/08/2011 05:40 AM, Na, Hyunik wrote:
> Hello JastAddJ developers,
>
> I’m reading JastAddJ source code and trying to understand it to implement a Java language extension for my research.
>
> I have two questions today. ( Certaninly, I’m going to ask many many questions. ☺ )
>
> In the AST directory of every FrontEnd or BackEnd compiler, the .java files generated from .ast, .jrag, and .jadd files are put.
> In the .java files, several kinds of comments give information about the generated entities ( nodes, methods, classes and interfaces ).
>
> Q1. What are the meanings of apilevels, internal, low-level and high-level, respectively?
> Some entities have “_at_apilevel” comments and some don’t. When does an entity have a @apilevel comment? When doesn’t one?
>
> Q2. The source location following each _at_declaredat in the comment is valuable information to track an entity’s definition site.
> But, some of the source location information seem to be wrong. For example, the generated AbstractDot.java file
> in the Java1.4FrontEnd/AST directory has
>
> -=-=-=
> ...
> ...
>
> /**
> * _at_ast method
> * _at_declaredat java.ast:1
> */
> public AbstractDot() {
> super();
>
>
> }
> /**
> * _at_ast method
> * _at_declaredat java.ast:7
> */
> public AbstractDot(Expr p0, Access p1) {
> setChild(p0, 0);
> setChild(p1, 1);
> }
> /**
> * _at_apilevel low-level
> * _at_ast method
> * _at_declaredat java.ast:14
> */
> protected int numChildren() {
> return 2;
> }
> /**
> * _at_apilevel internal
> * _at_ast method
> * _at_declaredat java.ast:20
> */
> public boolean mayHaveRewrite() {
> return false;
> }
> /**
> * Setter for Left
> * _at_apilevel high-level
> * _at_ast method
> * _at_declaredat java.ast:5
> */
> public void setLeft(Expr node) {
> setChild(node, 0);
> }
> /**
> * Getter for Left
> * _at_apilevel high-level
> * _at_ast method
> * _at_declaredat java.ast:12
> */
> public Expr getLeft() {
> return (Expr)getChild(0);
> }
> /**
> * _at_apilevel low-level
> * _at_ast method
> * _at_declaredat java.ast:18
> */
> public Expr getLeftNoTransform() {
> return (Expr)getChildNoTransform(0);
> }
> /**
> * Setter for Right
> * _at_apilevel high-level
> * _at_ast method
> * _at_declaredat java.ast:5
> */
> public void setRight(Access node) {
> setChild(node, 1);
> }
> /**
> * Getter for Right
> * _at_apilevel high-level
> * _at_ast method
> * _at_declaredat java.ast:12
> */
>
> ...
> ...
> -=-=-=
>
> In the above comments, the comments of the form "_at_declaredat java.ast:#" seem incorrect.
> Am I missing something?
>
>
>
>
> Probably, I don't need to understand the generated java files, but only need to understand .ast, .jrag, and .jadd files.
> Above questions are just out of my curiosity.
>
>
> - Hyunik
>
>
>
>
> _______________________________________________
> JastAdd mailing list
> JastAdd_at_cs.lth.se
> https://mail1.cs.lth.se/cgi-bin/mailman/listinfo/jastadd
>
Received on Thu Dec 08 2011 - 08:51:16 CET

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST