[Joypy-announce] joypy/Joypy: Minor cleanup.

Back to archive index
scmno****@osdn***** scmno****@osdn*****
Thu May 2 13:56:01 JST 2019


changeset fb49f3d96c2d in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=fb49f3d96c2d
user: Simon Forman <sform****@hushm*****>
date: Wed May 01 21:55:46 2019 -0700
description: Minor cleanup.

It turns out that the binary_number relation is used in such a way that it needs to be able to backtrack to preprend leading zeros to the list of bits it constructs to automatically build bitfields of a given width (with the collect//2 DCG.)

diffstat:

 thun/compiler.pl |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r d2b007f5e86e -r fb49f3d96c2d thun/compiler.pl
--- a/thun/compiler.pl	Sun Apr 28 08:16:38 2019 -0700
+++ b/thun/compiler.pl	Wed May 01 21:55:46 2019 -0700
@@ -1,4 +1,4 @@
-/*
+/*
 
 Copyright © 2018 Simon Forman
 
@@ -284,10 +284,10 @@
 low_half_word( I,  LowHalf) :-  LowHalf is I       /\ 0xFFFF.
 
 compile_program(Program, Binary) :-
-    phrase(pass0(Program, AST), [], _),
-    phrase(⟐(AST), IR),
-    phrase(linker(IR), ASM),
-    phrase(asm(ASM), Binary).
+    phrase(pass0(Program, IR), [], _),
+    phrase(⟐(IR), ASM),
+    phrase(linker(ASM), EnumeratedASM),
+    phrase(asm(EnumeratedASM), Binary).
 
 
 % Linker
@@ -555,8 +555,8 @@
     canonical_binary_number(Bits1, Number1),
     Number is Number1 + 2 ^ Pow.
 
+binary_number(   Bits , Number) :- canonical_binary_number(Bits, Number).
 binary_number([0|Bits], Number) :-           binary_number(Bits, Number).
-binary_number(   Bits , Number) :- canonical_binary_number(Bits, Number).
 
 
 % Helper code to write the list of bits as a binary file.


More information about the Joypy-announce mailing list
Back to archive index