diff --git a/thun/compiler.markII.pl b/thun/compiler.markII.pl index 66c2b40..98ed229 100644 --- a/thun/compiler.markII.pl +++ b/thun/compiler.markII.pl @@ -237,9 +237,10 @@ language. ⟐([]) --> []. ⟐([Term|Terms]) --> ⟐(Term), ⟐(Terms). -⟐(if_literal(Reg, Label)) --> % commands marked by setting high bit. - [and_imm(0, Reg, 0x8000), % 1 << 15 - eq_offset(Label)]. +⟐(if_literal(Reg, Label)) --> + [ior_imm(0, Reg, -30), % get just the two tag bits. + sub_imm(0, 0, 2), % subtract 2 to check if result is zero. + ne_offset(Label)]. % if reg = 0 jump to label. ⟐(if_zero(Reg, Label)) --> [sub_imm(Reg, Reg, 0), eq_offset(Label)]. diff --git a/thun/markII.rst b/thun/markII.rst index b656aaa..48516f4 100644 --- a/thun/markII.rst +++ b/thun/markII.rst @@ -101,3 +101,9 @@ the offsets will always be negative (or positive). SInce it's easier to deal with positive offsets and it's just as easy to allocate up as down, I'm going to do that. + +Next, we must check if the term is a literal (not a symbol) + +That involves rolling the value to get the top two bits and then checking +whether they are 10 or not. +