Commits

Anonymous committed 6df7780

Import of Iphigeneia version 1.0 revision 2011.1010 sources.

  • Participants
  • Parent commits e67cd80
  • Tags rel_1_0_2011_1010

Comments (0)

Files changed (36)

File doc/iphi.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!-- encoding: UTF-8 -->
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>The Iphigeneia Programming Language</title>
+  <!-- begin html doc dynamic markup -->
+  <script type="text/javascript" src="/contrib/jquery-1.6.4.min.js"></script>
+  <script type="text/javascript" src="/scripts/documentation.js"></script>
+  <!-- end html doc dynamic markup -->
 </head>
 <body>
 
 
 <p>The name Iphigeneia comes from the name of Agamemnon's daughter in Greek
 mythology.  The name was not chosen because of any particular significance
-this figure holds &mdash; I just think it's a nice name.  However, I suppose
+this figure holds  I just think it's a nice name.  However, I suppose
 if you wanted to force an interpretation, you could say that Iphigeneia
 has two natures, princess and priestess, and so does her namesake: imperative
 and functional.</p>
+(* Echo input to output until the first space *)
+var x in
+  while x /= 32 do
+    begin
+      x := input c in c;
+      print x
+    end

File eg/hello.iphi

+(* "Hello, world!" (or actually just "Hello") in Iphigeneia *)
+begin
+  print 72;
+  print 101;
+  print 108;
+  print 108;
+  print 111
+end
+#!/bin/sh
+
+# This assumes Falderal 0.4 is installed.  The easiest way to do this is to
+# install it as a Cabal package:
+#   $ hg clone https://bitbucket.org/catseye/falderal
+#   $ cd falderal
+#   $ cabal install --prefix=$HOME --user
+
+cd src && make iphi && cd ..
+falderal test standard tests/Iphigeneia.falderal && echo "All tests passed!"
+rm -f foo.txt
+cd src && make clean && cd ..

File test/01.iphi

-(* Test 'var ... in ...' and assignment *)
-
-var k in k := 5

File test/01.out

-k=5

File test/02.iphi

-(* Test 'begin ... end' *)
-
-var k in begin
-    k := 5;
-    k := k + 1
-end

File test/02.out

-k=6

File test/03.iphi

-(* Test nested 'var ... in ...' and arithmetic operators *)
-
-var i in var j in var k in begin
-    i := 2;
-    j := 3;
-    k := i + j;   (*  5 *)
-    i := j * k;   (* 15 *)
-    j := i / 2;   (*  7 *)
-    j := j - 1    (*  6 *)
-end

File test/03.out

-j=6
-i=15
-k=5

File test/04.iphi

-(* Test 'if ... then ... else' command with negative result *)
-
-var i in var j in begin
-    i := 2;
-    if i > 4 then
-      j := i * 2
-    else
-      j := i + 1
-end

File test/04.out

-j=3
-i=2

File test/05.iphi

-(* Test 'if ... then ... else' command with positive result *)
-
-var i in var j in begin
-    i := 2;
-    j := 1;
-    if i < 4 & j = 1 then
-      j := i * 6
-    else
-      j := i + 1
-end

File test/05.out

-j=12
-i=2

File test/06.iphi

-(* Test 'while ... do ...' *)
-
-var i in var j in begin
-    i := 100;
-    j := 0;
-    while i > 0 do begin
-        j := j + i;
-	i := i - 1
-    end
-end

File test/06.out

-i=0
-j=5050

File test/07.iphi

-(* Test 'while ... do ...' *)
-
-var a in var b in var c in
-begin
-    a := 10;
-    b := 1;
-    c := 2;
-    while a > 0 do
-        begin
-	    b := b * c;
-	    c := c + b;
-	    a := a - 1
-	end
-end

File test/07.out

-a=0
-c=140982598893793678070294688422804665931354981644880911847733136248186424030732278900819020480668973702640170212905160639132296847654374706155245147715674612235227680384069415566749494180212370357849936526549755341591854042821940420766722160615645816921368300
-b=140982598893793678070294688422804665931354981644880911847733136248186424030732278900819020480668973702640170212905160639132296847278898210361175931159590631877400396153764977561991761037132722898953457959352992281368361865140291306311370294857131871923863552

File test/08.iphi

-(* Test 'if ... then ... else' expression with negative result *)
-
-var a in var b in var c in
-begin
-    a := 10;
-    b := 2;
-    c := if a > 20 then a - b else a / b
-end

File test/08.out

-c=5
-b=2
-a=10

File test/09.iphi

-(* Test 'if ... then ... else' expression with positive result *)
-
-var a in var b in var c in
-begin
-    a := 10;
-    b := 2;
-    c := if a < 20 then a - b else a / b
-end

File test/09.out

-c=8
-b=2
-a=10

File test/10.iphi

-(* Test 'let ... in ...' *)
-
-var a in a := let b = 7 in 10 - b;

File test/10.out

-a=3

File test/11.iphi

-(* Test 'valueof ... in ...' *)
-
-var a in var b in begin
-    a := 10;
-    b := valueof c in begin
-        c := a * 2
-    end + 7
-end

File test/11.out

-b=27
-a=10

File test/12.iphi

-(* Test that 'var ... in ...' does not shadow *)
-
-var a in var b in
-begin
-    a := 1;
-    b := 2;
-    var a in
-        a := 3
-end

File test/12.out

-["Variable a already declared"]

File test/13.iphi

-(* Test that 'let ... in ...' does shadow *)
-
-var a in var b in
-begin
-    a := 2;
-    b := 3;
-    a := let b = 7 in a * b
-end

File test/13.out

-a=14
-b=3

File test/14.iphi

-(* Test 'loop ...' and 'repeat' *)
-
-var a in a :=
-    let c = 5 in let d = 1 in
-        loop
-	    if c = 0 then
-	        d
-	    else
-	        let d = d * c in
-	            let c = c - 1 in
-		        repeat

File test/14.out

-a=120

File test/Makefile

-# Makefile for Iphigeneia regression test suite.
-# $Id$
-
-# This Makefile currently assumes GNU make.
-
-# The suffixes are:
-# .iphi  Iphigeneia source code
-# .out	 Program run output  - used with 'diff' to check 'run'
-
-IPHI?=../src/iphi
-DIFF?=diff -u
-
-TESTS=01.run 02.run 03.run 04.run 05.run 06.run 07.run 08.run 09.run 10.run \
-      11.run 12.run 13.run 14.run
-
-all: ${TESTS}
-
-.PHONY: %.run
-
-%.run: %.iphi %.out
-	${IPHI} $< >OUTPUT
-	${DIFF} OUTPUT $*.out
-
-clean:
-	rm -rf OUTPUT

File test/cat.iphi

-(* Echo input to output until the first space *)
-var x in
-  while x /= 32 do
-    begin
-      x := input c in c;
-      print x
-    end

File test/hello.iphi

-(* "Hello, world!" (or actually just "Hello") in Iphigeneia *)
-begin
-  print 72;
-  print 101;
-  print 108;
-  print 108;
-  print 111
-end

File tests/Iphigeneia.falderal

+Test Suite for Iphigeneia
+=========================
+
+-> Functionality "Interpret Iphigeneia program" is implemented by
+-> shell command "(cat >foo.txt && src/iphi foo.txt)"
+
+-> Tests for functionality "Interpret Iphigeneia program"
+
+Test 'var ... in ...' and assignment.
+
+| var k in k := 5
+= k=5
+
+Test 'begin ... end'.
+
+| var k in begin
+|     k := 5;
+|     k := k + 1
+| end
+= k=6
+
+Test nested 'var ... in ...' and arithmetic operators.
+
+| var i in var j in var k in begin
+|     i := 2;
+|     j := 3;
+|     k := i + j;   (*  5 *)
+|     i := j * k;   (* 15 *)
+|     j := i / 2;   (*  7 *)
+|     j := j - 1    (*  6 *)
+| end
+= j=6
+= i=15
+= k=5
+
+Test 'if ... then ... else' command with negative result.
+
+| var i in var j in begin
+|     i := 2;
+|     if i > 4 then
+|       j := i * 2
+|     else
+|       j := i + 1
+| end
+= j=3
+= i=2
+
+Test 'if ... then ... else' command with positive result.
+
+| var i in var j in begin
+|     i := 2;
+|     j := 1;
+|     if i < 4 & j = 1 then
+|       j := i * 6
+|     else
+|       j := i + 1
+| end
+= j=12
+= i=2
+
+Test 'while ... do ...'.
+
+| var i in var j in begin
+|     i := 100;
+|     j := 0;
+|     while i > 0 do begin
+|         j := j + i;
+|         i := i - 1
+|     end
+| end
+= i=0
+= j=5050
+
+Test 'while ... do ...'.
+
+| var a in var b in var c in
+| begin
+|     a := 10;
+|     b := 1;
+|     c := 2;
+|     while a > 0 do
+|         begin
+|             b := b * c;
+|             c := c + b;
+|             a := a - 1
+|         end
+| end
+= a=0
+= c=140982598893793678070294688422804665931354981644880911847733136248186424030732278900819020480668973702640170212905160639132296847654374706155245147715674612235227680384069415566749494180212370357849936526549755341591854042821940420766722160615645816921368300
+= b=140982598893793678070294688422804665931354981644880911847733136248186424030732278900819020480668973702640170212905160639132296847278898210361175931159590631877400396153764977561991761037132722898953457959352992281368361865140291306311370294857131871923863552
+
+Test 'if ... then ... else' expression with negative result.
+
+| var a in var b in var c in
+| begin
+|     a := 10;
+|     b := 2;
+|     c := if a > 20 then a - b else a / b
+| end
+= c=5
+= b=2
+= a=10
+
+Test 'if ... then ... else' expression with positive result.
+
+| var a in var b in var c in
+| begin
+|     a := 10;
+|     b := 2;
+|     c := if a < 20 then a - b else a / b
+| end
+= c=8
+= b=2
+= a=10
+
+Test 'let ... in ...'.
+
+| var a in a := let b = 7 in 10 - b;
+= a=3
+
+Test 'valueof ... in ...'.
+
+| var a in var b in begin
+|     a := 10;
+|     b := valueof c in begin
+|         c := a * 2
+|     end + 7
+| end
+= b=27
+= a=10
+
+Test that 'var ... in ...' does not shadow.
+
+| var a in var b in
+| begin
+|     a := 1;
+|     b := 2;
+|     var a in
+|         a := 3
+| end
+= ["Variable a already declared"]
+
+Test that 'let ... in ...' does shadow.
+
+| var a in var b in
+| begin
+|     a := 2;
+|     b := 3;
+|     a := let b = 7 in a * b
+| end
+= a=14
+= b=3
+
+Test 'loop ...' and 'repeat'.
+
+| var a in a :=
+|     let c = 5 in let d = 1 in
+|         loop
+|             if c = 0 then
+|                 d
+|             else
+|                 let d = d * c in
+|                     let c = c - 1 in
+|                         repeat
+= a=120