mattiasw2 / teyjus

Automatically exported from code.google.com/p/teyjus
GNU General Public License v3.0
0 stars 0 forks source link

"register assignment1" in computing a normal form #52

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When trying to compile the attached files lambdaterms-church.mod and .sig, I 
get the error messages: 

$ tjcc lambdaterms-church
none(0,0) : Error : unable to perform register assignment1
none(0,0) : Error : unable to perform register assignment1
none(0,0) : Error : unable to perform register assignment1
$ 

The process of compiling the clause for the predicate "three" may involve 
computing a normal form for an expression that is the church numeral for 256 
(f\x\ (f(f ... (f x)))).  Have I bumped up against a design limitation for this 
version of Teyjus?  That is, is 256 too big.

Notice that the error message is not very useful (for example, the location in 
the file of the error).

Specifics about the implementation are below.

$ tjcc -v
Teyjus version 2.0-b2
$ uname -a
Linux gerhard 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011 
x86_64 GNU/Linux

Original issue reported on code.google.com by dale.a.m...@gmail.com on 3 Apr 2011 at 5:04

Attachments:

GoogleCodeExporter commented 9 years ago
There are only 256 registers but there should be no limitation in the size of 
the terms.

In the case of a first-order structure f (f (f (f (f (f ... the generated code 
uses only a fixed number of registers.

However in the case you are describing (involving binders), this is not the 
case, as the disassembled code shows:
                    put_index                A255, #2
                    put_index                A254, #2
                    put_index                A253, #2
                    put_index                A252, #2
                    put_index                A251, #2
                    put_index                A250, #2
                    put_index                A249, #2
                    put_index                A248, #2
                    put_index                A247, #2
                    .............
                    ..............

The problem only appears when compiling. Querying the evaluation of three
X = ((g\e\ g (g (g e)))  (e\f\ e (e f)) (f\x\ f (f x))).   
directly with tjsim gives the correct answer.

Original comment by fafounet@gmail.com on 7 Feb 2013 at 2:37

GoogleCodeExporter commented 9 years ago
The observation is correct---there is an easy reorganization of compilation 
steps that should get rid of this problem. This is a known issue from the first 
implementation of Teyjus that unfortunately did not get fixed in the second 
version. I hope that I or someone else will find some time to look at the code 
in the near future to correct this; I know what has to be done, it is mainly an 
issue of getting all the details right.

Original comment by gopalan....@gmail.com on 7 Feb 2013 at 11:35