简体   繁体   中英

Create an AST interactively with javafx

As referred to the title, I want to create an AST interactively with a certain grammar. 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 ?

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. But I haven't found anything yet with 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). 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. What you see in the Editor window is a rendering of the AST as surface syntax text. Your cursor selects an AST node by virtue of being nearest to text from that AST node.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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