import java.io.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
class macro
{
public static void main(String args[])throws IOException
{
int MDTC=1;
int MNTC=1;
int index=1;
int macroindex=0;
String arg[]=new String[10];
String mname[]=new String[10];
String MNT [][]=new String[10][10];
String MDT [][]=new String[10][10];
String output =new Scanner(new File("File1.txt")).useDelimiter("\\Z").next();
String result[]=output.split("\n");
String result1[]=output.split("[,\\s\\?]");
for(int k=0;k<result1.length;k++)
{
if(result1[k].equals("MACRO")||result1[k].equals("macro"))
{
mname[macroindex]=result1[k+2];
macroindex++;
}
}
System.out.println("\nMACRO NAME TABLE\n—————————————–");
System.out.println("VALUE OF MDTC\tMNTC\tNAME");
for(int k=0;k<macroindex;k++)
{
System.out.println("\t"+MDTC+"\t"+MNTC+"\t"+mname[k]);
MNTC=MNTC+1;
}
}}
Output:
aiktc@aiktc93 ~/Desktop $ java macro
MACRO NAME TABLE
—————————————–
VALUE OF MDTC MNTC NAME
1 1 &arg1
File1.txt
MACRO
ADDITION &arg1,&arg2,&arg3
MOV ax,&arg1
ADD ax,&arg2
ADD ax,&arg3
MEND
ADDITION 34,45,44
END
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
class macro
{
public static void main(String args[])throws IOException
{
int MDTC=1;
int MNTC=1;
int index=1;
int macroindex=0;
String arg[]=new String[10];
String mname[]=new String[10];
String MNT [][]=new String[10][10];
String MDT [][]=new String[10][10];
String output =new Scanner(new File("File1.txt")).useDelimiter("\\Z").next();
String result[]=output.split("\n");
String result1[]=output.split("[,\\s\\?]");
for(int k=0;k<result1.length;k++)
{
if(result1[k].equals("MACRO")||result1[k].equals("macro"))
{
mname[macroindex]=result1[k+2];
macroindex++;
}
}
System.out.println("\nMACRO NAME TABLE\n—————————————–");
System.out.println("VALUE OF MDTC\tMNTC\tNAME");
for(int k=0;k<macroindex;k++)
{
System.out.println("\t"+MDTC+"\t"+MNTC+"\t"+mname[k]);
MNTC=MNTC+1;
}
}}
Output:
aiktc@aiktc93 ~/Desktop $ java macro
MACRO NAME TABLE
—————————————–
VALUE OF MDTC MNTC NAME
1 1 &arg1
File1.txt
MACRO
ADDITION &arg1,&arg2,&arg3
MOV ax,&arg1
ADD ax,&arg2
ADD ax,&arg3
MEND
ADDITION 34,45,44
END
No comments:
Post a Comment