Actions

Difference between revisions of "Sx assembler"

From Just in Time

m
m (10 revisions: copying content from old site)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
 
* backend; create a list- and hex-file out of the generated parse tree.
 
* backend; create a list- and hex-file out of the generated parse tree.
 
===The 'complex instructions' Problem===
 
===The 'complex instructions' Problem===
One challenge in creating an assembler for SX is that the standard assembler knows a few 'complex' instructions that translate into two or more 'primitive' instructions. Extra challenging is that these complex instructions cannot be determined by their opcode alone. A 'mov' instruction, for instance can be primitive (<code>mov w, #10</code>) or complex (<code>mov SomeAddress, #10</code>, which translates into <code>mov w, #10</code> followed by <code>mov SomeAddress, w</code>
+
One challenge in creating an assembler for SX is that the standard assembler knows a few 'complex' instructions that translate into two or more 'primitive' instructions. Extra challenging is that these complex instructions cannot be determined by their opcode alone. A 'mov' instruction, for instance can be primitive (<code>mov w, #10</code>) or complex (<code>mov SomeAddress, #10</code>), which translates into <code>mov w, #10</code> followed by <code>mov SomeAddress, w</code>
 +
 
 
===Status===
 
===Status===
 
This project is on halt right now.
 
This project is on halt right now.
 
[[Category:SX development environment]]
 
[[Category:SX development environment]]

Latest revision as of 22:07, 12 July 2010

I'm toying with the creation of a boost.spirit based SX assembler, written in C++. update: I'm reconsidering writing the grammar of the assembler in ANTLR instead of spirit, so that i could use the same grammar in Java (eclipse) and C++ (tool chain).

The sx assembler consists of 2 parts:

  • frontend; create a syntax tree out of the program text. There is a working spirit grammar without actions (the actual tree building). Open items are:
    • include
    • macros
    • recognizing opcodes that start in the label column (the first column). Currently, a word that starts in the first column will be parsed as a label, never as an opcode.
  • backend; create a list- and hex-file out of the generated parse tree.

The 'complex instructions' Problem

One challenge in creating an assembler for SX is that the standard assembler knows a few 'complex' instructions that translate into two or more 'primitive' instructions. Extra challenging is that these complex instructions cannot be determined by their opcode alone. A 'mov' instruction, for instance can be primitive (mov w, #10) or complex (mov SomeAddress, #10), which translates into mov w, #10 followed by mov SomeAddress, w

Status

This project is on halt right now.