LOLCODE to 6502 Compiler

At a Glance


Notes and Documentation


PowerPoint Presentations

  • CPSC510 LOL6502 Milestone Presentations: One | Two | Three

Slides used for milestone presentations in class. Details the progress of my project, and explains most of the concepts I've used. Worth a look.


Prologue: Common Components

These files are required across both components of the project. LNode encapsulates all the information for a given node in the IR tree. JLex and java_cup are both required libraries in order to compile the .lex and .cup files respectively.


Stage I: Symbols and Grammar

The first component is the scanning and parsing of a given input file. LOLCODE.lex is the specification file for JLex to produce the scanner, and LOLCODE.cup is the specs for java_cup to produce the parser.


Stage II: Compiler and Optimizations

The second component is the actual compilation from the IR tree, into 6502 assembly. LStackCompiler spits out a mixture of SM and actual assembly (making use of the LStackTable and LTable).

When running the output in a simulator, stdlib.65s is required to ensure the SM instructions are properly executed.


Epilogue: Example and Output

  • LOLCODE:
  • 6502:

Examples written in LOLCODE, and the resulting output in 6502 assembly. Fun times abound.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License