Códigos antigos - ChuckFelix765/Projeto-Compiladores GitHub Wiki

//Main.java
import java.io.IOException;
import java.util.List;
import java.io.File;  // Import the File class
import java.io.FileNotFoundException;  // Import this class to handle errors
import java.util.Scanner; // Import the Scanner class to read text files

public class Main{
	public static void main(String[] args) throws IOException {
		try{
			File arq = new File("teste.txt");
			Scanner ler = new Scanner(arq);
			List<Token> tokens = null;
			while (ler.hasNextLine()) {
				String data = ler.nextLine();
				Lexer lexer = new Lexer(data);
				tokens = lexer.getTokens();
				for(Token token : tokens){
					System.out.println(token);
				}
			}
			ler.close();
			/*List<Token> tokens = null;
			String data = "4.0 + 2";
			Lexer lexer = new Lexer(data);
			tokens = lexer.getTokens();
			for(Token token : tokens) {
				System.out.println(token);
			}*/
		}catch(FileNotFoundException e){
			System.out.println("Arquivo nao encontrado");
      		e.printStackTrace();
		}
	}
}```
⚠️ **GitHub.com Fallback** ⚠️