From 3cf27f6916409d1203aea8cb0a685ae8e983f023 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 18 Jul 2017 13:19:01 +0000 Subject: Raw instructions --- ABC/Assembler.dcl | 1 + ABC/Assembler.icl | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'ABC') 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 -- cgit v1.2.3