Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / src / tests / CodeGeneratorTest.java
yoichiro on 2 May 2020 1 KB ๅˆ‡ใ‚Š็›ดใ—
package tests;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;

import algorithms.*;
import code.ast.FieldDeclaration;
import code.ast.MethodDeclaration;
import code.ast.TypeDeclaration;
import models.dataFlowModel.*;
import parser.*;

public class CodeGeneratorTest {
	public static void main(String[] args) {
		File file = new File("models/POS.model");
		try {
			Parser parser = new Parser(new BufferedReader(new FileReader(file)));
			DataFlowModel model;
			try {
				model = parser.doParse();
				ResourceDependencyGraph graph = DataStorageNecessity.run(model);
				EdgeTransitionSelectable.run(graph);
				DataStorageDecision.run(graph);
				ArrayList<TypeDeclaration> codetree = MethodBodyGenerator.doGenerate(graph, model, CodeGenerator.doGenerate(graph, model));
				System.out.println(codetree);
			} catch (ExpectedChannel | ExpectedChannelName | ExpectedLeftCurlyBracket | ExpectedInOrOutKeyword
					| ExpectedStateTransition | ExpectedEquals | ExpectedRHSExpression | WrongLHSExpression
					| WrongRHSExpression | ExpectedRightBracket e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
}