简体   繁体   English

使用javafx交互式创建AST

[英]Create an AST interactively with javafx

As referred to the title, I want to create an AST interactively with a certain grammar. 如标题所述,我想以某种语法交互式地创建AST。 But I don't have any idea on how to do it... So my question is: 但是我不知道如何做...所以我的问题是:

Which technology is available right now in creating and editing an AST with javaFX ? 使用javaFX创建和编辑AST时可以使用哪种技术?

I couldn't see anything on the internet regarding to this... I know that Webview does work on JavaFX and probably an internet technology will solve that. 我在互联网上看不到与此相关的任何信息。我​​知道Webview确实可以在JavaFX上运行,并且很可能可以通过互联网技术解决该问题。 But I haven't found anything yet with Webview ... 但是我还没有用Webview找到任何东西...

PS: One critic information for this, is that my AST must be created by a click of a mouse and not written by the keyboard (as a traditional IDE). PS:对此的一个批评信息是,我的AST必须通过单击鼠标创建,而不是由键盘(作为传统的IDE)编写。 I'm open in different views, so please feel free to say anything. 我持不同意见,请随时说些什么。 Any information for solving this, will be appreciated thank you :) 解决此问题的任何信息,将不胜感激,谢谢:)

What is you want is called a structure editor . 您想要的就是所谓的结构编辑器

Such an editor knows the grammar of the language you want to work with, and works with an AST for program rather than text. 这样的编辑器知道您要使用的语言的语法,并且使用AST而不是文本来编写程序。 What you see in the Editor window is a rendering of the AST as surface syntax text. 在“编辑器”窗口中看到的是AST作为表面语法文本的呈现 Your cursor selects an AST node by virtue of being nearest to text from that AST node. 您的光标会选择一个AST节点,因为它最接近该AST节点中的文本。

Given a cursor/AST node, you can then perform various operations, such as "cut subtree", "paste subtree", "move subtree", or replace a subtree by typing a phrase, causing the editor to parse what you type, often in realtime, to build corresponding tree nodes. 给定游标/ AST节点后,您可以执行各种操作,例如“剪切子树”,“粘贴子树”,“移动子树”,或通过键入短语来替换子树,从而使编辑器经常解析您键入的内容实时构建相应的树节点。

Such editors can usually provide guidance to the process by telling you what syntactic category you are editing (expression, statement, declaration) and usually guesses what you should type next if it is known by the grammar. 这样的编辑器通常可以通过告诉您正在编辑的语法类别(表达式,语句,声明)来为过程提供指导,并且通常会猜测如果语法已知该下一步应该键入什么。

The most famous one (being essentially first) was called the "Synthesizer Generator". 最著名的(基本上是第一台)被称为“合成器生成器”。 I doubt you can get that anymore. 我怀疑你能再做到了。 The Wikipedia link provided above has a long list of systems, some of which you can get now. 上面提供的Wikipedia链接有很长的系统列表,您现在可以获得其中的一些。

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

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