From fe795704a60ee3cb2d36effecc984ebab6d6f894 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Wed, 1 May 2019 21:55:46 -0700 Subject: [PATCH] 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.) --- thun/compiler.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/thun/compiler.pl b/thun/compiler.pl index 32ee3a5..87be186 100644 --- a/thun/compiler.pl +++ b/thun/compiler.pl @@ -1,4 +1,4 @@ -/* +/* Copyright © 2018 Simon Forman @@ -284,10 +284,10 @@ high_half_word(I, HighHalf) :- HighHalf is I >> 16 /\ 0xFFFF. 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([1|Bits], Number):- canonical_binary_number(Bits1, Number1), Number is Number1 + 2 ^ Pow. -binary_number([0|Bits], Number) :- binary_number(Bits, Number). binary_number( Bits , Number) :- canonical_binary_number(Bits, Number). +binary_number([0|Bits], Number) :- binary_number(Bits, Number). % Helper code to write the list of bits as a binary file.