Question
Syntactic Analyzer (assembly) in java. Complete program to cover the following points . Identify lines that end in : (tag), check that there are no
Syntactic Analyzer (assembly) in java.
Complete program to cover the following points.
Identify lines that end in ":" (tag), check that there are no spaces in the name and save the name in an arraylist as long as it has not been saved before. Validate that you do not have two with the same name.
Invalid tags:
Tag :: double ":" With space: no spaces allowed 1234: can not be only number, must start with letter or underscore _
Program:
package softwaresistemas;
import java.io.*;
public class FileASM {
public static void main (String args[]){
String linea;
try {
File archivoFuente = new File ("C:/Ensamblador/02TLIGHT.ASM");
FileReader fr = new FileReader (archivoFuente);
BufferedReader br = new BufferedReader(fr);
FileWriter archivoMaquina = new FileWriter("c:/Ensamblador/02TLIGHTNuevo.ASM");
PrintWriter pw = new PrintWriter(archivoMaquina);
while((linea=br.readLine())!=null){
linea = linea.trim();
if(linea.length()>0){
if(!linea.startsWith(";")){
System.out.println(linea);
pw.println(linea);
}
}
}
fr.close();
archivoMaquina.close();
}
catch(Exception e3){
e3.printStackTrace();
}finally{
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started