[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Real numbers..




Hello,

I am just starting to use the centuar system so this is probably
quite a basic question...

Is there a standard method of passing real numbers from metal into
typol and are there any built in prolog functions able to accept 
real numbers as arguments?

So far I have implemented a parser (in metal) and a
debugger-interpreter for a simple functional language (using
Typol/prolog). This runs well but, unfortunately, operates only
upon integers. 

  I define integral tokens in the metal file as:

   .... <num> ::= %NUMBER ;
         number-atom(%NUMBER)
   .....
     abstract syntax
         number -> implemented as INTEGER;

  the representation then gets passed through various TYPOL rules
  such as:
 
   div(AV, BV, CV)
   ----------------
   (divide(), number AV, number BV -> number CV) ;
  
  and finally into prolog functions like:

   func$div(A,B,C) :- C is A/B.   

  
Now I want to include some sort of representation for real numbers
in the language. I'd like to think that:
    
     <real> ::= %REAL_TOKEN;
      real-atom(%REAL_TOKEN)
     .....
     abstract syntax
       real -> implemented as BIGNUM;

would work but the documentation I have on metal tells me that this
representation is illegal in TYPOL applications. I then also have
the problem of finding prolog functions capable of handling 
real numbers. 

Are there any constructs availible to cater for real numbers?

Thanks...
  Brad Alexander.