• 大小: 49KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-07-07
  • 语言: Java
  • 标签: 语法树  

资源简介

带界面的java实现词法分析器、错误信息、语法分析器、错误信息和语法树生成

资源截图

代码片段和文件信息

package word;

import java.net.URL;
import java.util.ResourceBundle;

import javafx.fxml.Fxml;
import javafx.fxml.Initializable;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;


public class DrawingTreeController implements Initializable{
@Fxml
private TreeView treeView;
@Fxml
private ScrollPane pane;

private GrammerTree root;

@Override
public void initialize(URL location ResourceBundle resources) {
// TODO Auto-generated method stub

treeView.prefHeightProperty().bind(pane.heightProperty());
treeView.prefWidthProperty().bind(pane.widthProperty());
root = Grammer.root;
TreeItem item = new TreeItem<>(root.getName());
treeView.setRoot(item);
drawing(root item);
}
private void drawing(GrammerTree treeTreeItem item){
if (tree.getChildren().size()==0) {
return;
}
for(GrammerTree node:tree.getChildren()){
TreeItem newItem = new TreeItem<>(node.getName());
item.getChildren().add(newItem);
drawing(node newItem);
}
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         301  2018-03-28 14:40  FundamentalsOfCompiling\.classpath
     文件         399  2018-03-28 14:40  FundamentalsOfCompiling\.project
     文件         598  2018-03-28 14:40  FundamentalsOfCompiling\.settings\org.eclipse.jdt.core.prefs
     文件        2513  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\DrawingTreeController.class
     文件         550  2018-05-04 11:39  FundamentalsOfCompiling\bin\word\DrawingTreePane.fxml
     文件         852  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\ErrorNode.class
     文件       19816  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\Grammer.class
     文件        1287  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\GrammerTree.class
     文件        1410  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\Main.class
     文件        3492  2018-05-14 10:10  FundamentalsOfCompiling\bin\word\MainPane.fxml
     文件        1761  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\MainPaneController$1.class
     文件       14639  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\MainPaneController.class
     文件        2218  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\TableWordInfo.class
     文件        3687  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\TreeType.class
     文件        3663  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\WordDeal.class
     文件        2159  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\WordInfo.class
     文件        3869  2018-05-21 08:18  FundamentalsOfCompiling\bin\word\WordType.class
     文件        1118  2018-05-14 04:38  FundamentalsOfCompiling\src\word\DrawingTreeController.java
     文件         550  2018-05-04 11:39  FundamentalsOfCompiling\src\word\DrawingTreePane.fxml
     文件         449  2018-04-27 10:53  FundamentalsOfCompiling\src\word\ErrorNode.java
     文件       30857  2018-05-14 15:11  FundamentalsOfCompiling\src\word\Grammer.java
     文件         656  2018-05-01 16:25  FundamentalsOfCompiling\src\word\GrammerTree.java
     文件         687  2018-05-14 15:05  FundamentalsOfCompiling\src\word\Main.java
     文件        3492  2018-05-14 10:10  FundamentalsOfCompiling\src\word\MainPane.fxml
     文件       13766  2018-05-14 14:03  FundamentalsOfCompiling\src\word\MainPaneController.java
     文件        1800  2018-04-08 02:45  FundamentalsOfCompiling\src\word\TableWordInfo.java
     文件        1228  2018-05-14 15:10  FundamentalsOfCompiling\src\word\TreeType.java
     文件        4380  2018-04-08 10:37  FundamentalsOfCompiling\src\word\WordDeal.java
     文件        1484  2018-04-08 01:15  FundamentalsOfCompiling\src\word\WordInfo.java
     文件        3504  2018-05-14 11:59  FundamentalsOfCompiling\src\word\WordType.java

评论

共有 条评论