diff options
author | Camil Staps | 2017-07-18 13:19:01 +0000 |
---|---|---|
committer | Camil Staps | 2017-07-18 13:19:01 +0000 |
commit | 3cf27f6916409d1203aea8cb0a685ae8e983f023 (patch) | |
tree | e1acb4cee21fb8464807f9c3b97950a7be3b423c /ABC | |
parent | Raw annotations (diff) |
Raw instructions
Diffstat (limited to 'ABC')
-rw-r--r-- | ABC/Assembler.dcl | 1 | ||||
-rw-r--r-- | ABC/Assembler.icl | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/ABC/Assembler.dcl b/ABC/Assembler.dcl index 618a885..acda095 100644 --- a/ABC/Assembler.dcl +++ b/ABC/Assembler.dcl @@ -88,6 +88,7 @@ from ABC.Machine.GraphStore import ::Desc // Clean compiler additions | Comment String | Annotation Annotation + | Raw String instance toString Assembler instance toString Statement diff --git a/ABC/Assembler.icl b/ABC/Assembler.icl index 2e80a05..57ad36a 100644 --- a/ABC/Assembler.icl +++ b/ABC/Assembler.icl @@ -15,10 +15,11 @@ where instance <<< Assembler where - <<< f [] = f - <<< f [stm=:(Label _):r] = f <<< stm <<< "\r\n" <<< r + <<< f [ ] = f + <<< f [stm=:(Label _) :r] = f <<< stm <<< "\r\n" <<< r <<< f [stm=:(Descriptor _ _ _ _):r] = f <<< r - <<< f [stm=:(Annotation _):r] = f <<< stm <<< "\r\n" <<< r + <<< f [stm=:(Annotation _) :r] = f <<< stm <<< "\r\n" <<< r + <<< f [stm=:(Raw _) :r] = f <<< stm <<< "\r\n" <<< r <<< f [stm :r] = f <<< "\t" <<< stm <<< "\r\n" <<< r instance <<< Statement where <<< f st = f <<< toString st @@ -55,6 +56,7 @@ gPrint{|CONS of d|} fx (CONS x) = case d.gcd_name of "Print" = ['print\t"'] ++ quote (fx x) ++ ['"'] "Comment" = ['| '] ++ fx x "Annotation" = fx x + "Raw" = fx x name = tl (cons (fromString name)) ++ ['\t':fx x] where cons :: ![Char] -> [Char] @@ -125,6 +127,7 @@ translate [Label _ :r] lc syms = translate r lc syms translate [Descriptor _ _ _ _:r] lc syms = translate r lc syms translate [Comment _ :r] lc syms = translate r lc syms translate [Annotation _ :r] lc syms = translate r lc syms +translate [Raw _ :r] lc syms = translate r lc syms translate [stm :r] lc syms = [trans stm lc syms:translate r (lc+1) syms] where |