Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Dolph Dolph Dolph

Name: Anonymous 2009-03-28 18:29

I bet you can't write a fucking assembler. Faggots.

Name: Anonymous 2009-03-28 18:41

No Exceptions

Name: Anonymous 2009-03-28 18:43

This may surprise you, but I am currently one of the main contributors to a well known assembler.

Name: Anonymous 2009-03-28 18:50

I got us started.

import java.io.*;
public class Assembler() {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new FileInputStream(new FileReader(args[1]));
        String file = "";
        String line;
        while(!(line=br.readLine()).equals("")) {
            file+=line+"\n";
        }
        Assembler a = new Assembler(file);
        a.compile();
        a.run();
    }
    private String[] lines;
    private int indentlevel;
    public Assembler(String toCompile) {
        indentlevel = 0;
        lines = toCompile.split("\r?\n\r?");
    }
    public void compile() {
        for(int i=0; i<lines.length; i++) {
            for(int j=0; j<indentlevel; j++) {
                if(lines[i].charAt(j)!='\t') throw new FIOCException("Badly indented code, line: "+i);
            }
            if(lines[i].charAt(lines[i].length()-1)=='{') indentlevel+=1;
            else if(lines[i].charAt(lines[i].length()-1)!=';') throw new NoSemiColonException("Missing Semicolon, line: "+i);
        }
    }
    public void run() {
        //unimplemented
        System.out.println("Penix");
    }
}

Name: Anonymous 2009-03-28 20:19

I scrapped it and got us started in Haskell instead:

fac = product . enumFromTo 2
loeb = fix (fmap . flip id =<<)
main = putStrLn "hAsm 0.0.1"

Name: Anonymous 2010-12-26 4:53


Don't change these.
Name: Email:
Entire Thread Thread List