Skip to content

Instantly share code, notes, and snippets.

View vnkdj5's full-sized avatar
πŸ‘¨β€πŸ’»
Improving Skills

Vaibhav Kumbhar vnkdj5

πŸ‘¨β€πŸ’»
Improving Skills
View GitHub Profile
@vnkdj5
vnkdj5 / input_b2.java
Last active May 23, 2021 09:13
Write a program using Lex specifications to implement lexical analysis phase of compiler to generate tokens of subset of Java program.
import java.io.*;
class Test
{
public static void main(String args[])
{
int b;
int a=12;
if(a==12)
{
;
@vnkdj5
vnkdj5 / pass2.asm
Created February 7, 2019 06:51
Output of pass 2 of macro
START 100
+MOVER AREG 10
+ADD AREG ='1'
+MOVER CREG 20
+ADD CREG ='5'
+MOVER BREG 100
+MOVER AREG 200
+ADD BREG ='15'
+ADD AREG ='10'
END
@vnkdj5
vnkdj5 / intermediate.txt
Created February 7, 2019 06:50
INPUT DATA
START 100
M1 10, 20, &B=CREG
M2 100, 200, &V=AREG, &U=BREG
END
@vnkdj5
vnkdj5 / MNTEntry.java
Created February 7, 2019 06:43
Pass 2 0f macro Main Class
public class MNTEntry {
String name;
int pp,kp,mdtp,kpdtp;
public MNTEntry(String name, int pp, int kp, int mdtp, int kpdtp) {
super();
this.name = name;
this.pp = pp;
@vnkdj5
vnkdj5 / Pass2.txt
Created January 14, 2019 18:55
Outpur of Pass2 asm
04 1 108
01 1 109
05 1 101
10 0 101
00 0 000
00 0 019
@vnkdj5
vnkdj5 / Pass2.java
Created January 14, 2019 18:54
Implement Pass-II of two pass assembler for pseudo-machine in Java using object oriented features. The output of assignment-1 (intermediate file and symbol table) should be input for this assignment.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
public class Pass2 {
ArrayList<TableRow> SYMTAB,LITTAB;
public Pass2()
@vnkdj5
vnkdj5 / TableRow.java
Created January 14, 2019 18:53
TableRow class for PASS II assmbler
public class TableRow {
String symbol;
int address;
int index;
public TableRow(String symbol, int address) {
super();
this.symbol = symbol;
this.address = address;
@vnkdj5
vnkdj5 / IC.txt
Created January 14, 2019 17:58
Pass 1 ASM Input and Output
(AD,01) (C,100)
(DL,02) (C,3)
(IS,04) 1 (S,03)
(IS,01) 1 (S,04)
(IS,05) 1 (S,05)
(AD,04) (S,1)+1
(IS,010) (S,05)
(AD,03) (S,6)+1
(IS,00)
(DL,01) (C,19)
@vnkdj5
vnkdj5 / PassOne.java
Created January 14, 2019 17:55
Design suitable data structures and implement pass-I of a two-pass assembler for pseudo-machine in Java using object oriented feature. Implementation should consist of a few instructions from each category and few assembler directives.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
public class PassOne {
int lc=0;
@vnkdj5
vnkdj5 / INSTtable.java
Created January 14, 2019 17:51
Design suitable data structures and implement pass-I of a two-pass assembler for pseudo-machine in Java using object oriented feature. Implementation should consist of a few instructions from each category and few assembler directives.
import java.util.HashMap;
public class INSTtable {
HashMap<String, Integer> AD,RG,IS,CC,DL;
public INSTtable()
{
AD=new HashMap<>();
CC = new HashMap<>();
IS = new HashMap<>();