aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2017-07-17 21:47:44 +0000
committerCamil Staps2017-07-17 21:47:44 +0000
commitc83e5d354b9c66491e707f3d6580709fd68a11ca (patch)
treededd23cc3a20424206228cfc71060de40f3114e6
parentAdd <<< for Assembler and Statement (diff)
Add Comments
-rw-r--r--ABC/Assembler.dcl3
-rw-r--r--ABC/Assembler.icl2
2 files changed, 4 insertions, 1 deletions
diff --git a/ABC/Assembler.dcl b/ABC/Assembler.dcl
index 6ba9db7..03b8820 100644
--- a/ABC/Assembler.dcl
+++ b/ABC/Assembler.dcl
@@ -71,11 +71,12 @@ from ABC.Machine.GraphStore import ::Desc
| Update_b BSrc BDst
| AddI
| DecI
- | GtI
+ | GtI
| IncI
| LtI
| MulI
| SubI
+ | Comment String
instance toString Assembler
instance toString Statement
diff --git a/ABC/Assembler.icl b/ABC/Assembler.icl
index 29e2d5b..8167f70 100644
--- a/ABC/Assembler.icl
+++ b/ABC/Assembler.icl
@@ -36,6 +36,7 @@ gPrint{|CONS of d|} fx (CONS x) = case d.gcd_name of
"Descriptor" = []
"Dump" = ['dump\t"'] ++ quote (fx x) ++ ['"']
"Print" = ['print\t"'] ++ quote (fx x) ++ ['"']
+ "Comment" = ['| '] ++ fx x
name = tl (cons (fromString name)) ++ ['\t':fx x]
where
cons :: ![Char] -> [Char]
@@ -104,6 +105,7 @@ translate :: Assembler Int SymTable -> [Instruction]
translate [] _ _ = []
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 [stm :r] lc syms
= [trans stm lc syms:translate r (lc+1) syms]
where