This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
CS4308_CompilerProject/src/edu/jt_kb/cs4308/compiler/Driver.java

38 lines
1.1 KiB
Java
Raw Normal View History

2023-10-07 15:46:08 +00:00
package edu.jt_kb.cs4308.compiler;
import java.io.File;
import java.util.Scanner;
2023-10-07 15:46:08 +00:00
public class Driver {
public static void main(String[] args) {
System.out.println("Default Setup");
Driver program = new Driver();
program.start();
}
public void start() {
File java = new File("src/edu/jt_kb/cs4308/compiler/resources/Java.txt");
File python = new File("src/edu/jt_kb/cs4308/compiler/resources/Python.txt");
readFile(java);
System.out.println();
readFile(python);
}
private static void readFile(File file) {
try (Scanner input = new Scanner(file)) {
while (input.hasNextLine()) {
String line = input.nextLine();
char[] chars = line.toCharArray();
String result = "[";
for (char curr : chars) {
result += curr;
}
result += "]";
System.out.println(result);
}
} catch (Exception e) {
e.printStackTrace();
}
2023-10-07 15:46:08 +00:00
}
}