简体   繁体   English

如何使用Java解析Clojure语法并将其可视化

[英]How to use Java to parse Clojure grammar and visualize it

I need to parse Clojure code (not really long) inside Java and build a tree with tokens. 我需要在Java内部解析Clojure代码(不是很长),并用令牌构建一棵树。 is there a possibility to use standard Clojure lib for that? 是否有可能为此使用标准Clojure库? What is the easiest way to display these data visually? 直观显示这些数据的最简单方法是什么?

Use clojure.lang.RT to require clojure.edn and use clojure.edn/read to get a Clojure data structure from a source string or file without evaluating it. 使用clojure.lang.RT要求clojure.edn并使用clojure.edn/read从源字符串或文件获取Clojure数据结构,而不对其求值。 A guide to using clojure.lang.RT from Java . Java使用clojure.lang.RT的指南

You can traverse the source code of your Clojure source and generate a graph data structure from it. 您可以遍历Clojure源代码的源代码并从中生成图形数据结构。 Then use Graphviz library to visualise that graph. 然后使用Graphviz库可视化该图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM