axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Axiom BNF


From: Ralf HEMMECKE
Subject: Re: [Axiom-developer] Axiom BNF
Date: Mon, 25 Oct 2004 14:43:59 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

As for the semi-colons in Aldor...
For compatibility reasons Aldor has the #pile directive. Try

aldor -fx -laldor xxx.as
xxx

with the attached program. In my case it compiles and prints 8.

Nevertheless, I would not suggest the #pile mode.

Ralf

Christopher Chamber wrote:
The Aldor (external C-based compiler) and the Spad (internal lisp compiler)
accept approximately the same language except that Aldor wants trailing
semi-colons and has some extensions/modifications for dealing with the
fact that it has to run standalone.

The BNF in the book or at the aldor.org site should be nearly correct
for the Spad compiler.

#include "aldor"
#include "aldorio"

#pile

MyDomain(n: Integer): with
    f: % -> Integer
    coerce: Integer -> %
== add
    Rep == Integer
    coerce(a: Integer): % == 
        per a

    f(x: %): Integer == 
        i: Integer := rep x
        return(i+n)

executeIt(): () ==
    import from Integer
    import from MyDomain 1
    n: Integer := 7
    m: MyDomain 1 := n :: MyDomain 1
    stdout << f m << newline

executeIt()


reply via email to

[Prev in Thread] Current Thread [Next in Thread]