Monday, March 27, 2017

Compil-- COOKIE BREAK!

So. My experience researching compilers has been rocky, with learning Flex and Bison while dealing with the constrained languages and profuse errors. I eventually got my simple compiler for LC-3 Assembly to work.

Flex code:
flex.png
This code identifies the tokens (see previous posts) in the LC-3 language

Bison code:
bison.png
This code specifies and identifies statements, valid sequences of tokens

This code took code from a simple version of Assembly adapted for LC-3, a simplified model of a computer, and turned it into binary (0s and 1s). Here you can see my output versus the output of an online LC-3 compiler.
result.pngpres.JPG
(^The result of 30+ hours of toil and tribulation)

Even with this (small) success, I've barely made progress on my overall project of making a compiler.


Referring to the above diagram, I have only researched and coded for the "Front End", and especially simple code at that. Starting the year, I knew this was an ambitious project, normally undertaken only by upperclassmen undergrad students. At my rate, it doesn't appear that I can finish a full compiler.
Instead, I will switch to a different (and tastier) topic in computer science that I have been interested in for a while:

COOKIES 

(coming at you next time!)

Sources:
Blood
Sweat
Tears
http://dinosaur.compilertools.net/

No comments:

Post a Comment