AST instrospection 
Author Message
 AST instrospection

I know this isn't something that's available yet, but I'd certainly like
it to be on the wishlist...

If I could get the AST of a Proc object, I could do some real cool stuff
with RHDL (like logic synthesis in addition to just simulation ;-)

So what I would like to be able to do is something like:

a = Proc.new { .... some Ruby code .... }
procAST = a.AST #get the AST for the proc 'a'

#walk thru the AST:
procAST.walk { |node|
  #do something with the nodes

Quote:
}

Any plans for introspection down to the AST level?

Phil



Sun, 31 Oct 2004 05:41:34 GMT  
 AST instrospection

Quote:

> I know this isn't something that's available yet, but I'd certainly like
> it to be on the wishlist...

> If I could get the AST of a Proc object, I could do some real cool stuff
> with RHDL (like logic synthesis in addition to just simulation ;-)

I'll second that wish. In my application/library, user code has blocks
that can assign to C struct members using accessors. But it is very easy
to forget about Ruby and type "x = 3" instead of "self.x = 3". IIUC,
having the Proc's AST would let me at least warn about this kind of
mistake, or even correct it. Also, there would be the possibility of
generating C code from the AST... very cool!


Sun, 31 Oct 2004 06:38:36 GMT  
 AST instrospection
Hi,

In message "AST instrospection"

|Any plans for introspection down to the AST level?

Never under the current implementation.  The future Ruby will
implement front-end (parser) and backend (VM) separation, so there
will be a chance for AST API to be open.

                                                        matz.



Sun, 31 Oct 2004 08:07:13 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. apl-l UseNet batch for Sun Mar 21 23:59:07 AST 1993

2. apl-l UseNet batch for Mon Mar 29 23:59:09 AST 1993

3. apl-l UseNet batch for Sat Jan 30 23:59:08 AST 1993

4. apl-l UseNet batch for Fri Jan 29 23:59:05 AST 1993

5. Program lockup on AST 133

6. Updating AST's in a functional language (was: 8-queens contest)

7. Updating AST's in a functional language (was: 8-queens contest)

8. AST in GNAT

9. Call an AST procedure from SYS$SETIMR in COBOL

10. Ada tasking rules and AST's...

11. python source -> ast

12. AST structures and memory leaks

 

 
Powered by phpBB® Forum Software