is it possible to pass a tree (data structure) to clojure and work on it?

独自空忆成欢 提交于 2019-12-11 03:03:10

问题


tree structure build by from java code passed to clojure REPL and then using that data structure work on it. this tree is formed by ANTLR after parsing the code.


回答1:


Clojure's interop with java is very good. Is there some reason you can't call ANTLR from Clojure and simply used the generated tree that way?

http://clojure.org/java_interop




回答2:


you could include the java class that produces the tree in your project and call it from the REPL to get an Object. then Clojure that Object to your hearts content :)

The only real decision you need to make is should control start in Clojure which then calls java or the other way around. I personally find it easier to start in Clojure because I find leiningen more pleasant to work with than maven.



来源:https://stackoverflow.com/questions/7659423/is-it-possible-to-pass-a-tree-data-structure-to-clojure-and-work-on-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!