gfcc report

This commit is contained in:
aarne
2004-09-28 19:44:02 +00:00
parent 55c603ba87
commit 57ff3cc5a3
11 changed files with 137 additions and 71 deletions

View File

@@ -28,12 +28,12 @@ jvm.tmp -- pseudo-JVM produced by GF linearization
Required programs to use the compiler:
-------------------------------------
gf+ -- Grammatical Framework version 2.0+, >= 23/9/2004
jasmin -- JVM assembler (to compile Foo.j to Foo.class)
gf+ -- Grammatical Framework version 2.1beta, >= 23/9/2004
jasmin -- JVM assembler (to compile Foo.j to Foo.class)
Required programs to build the compiler:
---------------------------------------
bnfc -- BNF Converter version 2.1+, >= 23/9/2004
bnfc -- BNF Converter version 2.2beta, >= 23/9/2004
happy -- parser generator for Haskell, >= 1.13
alex -- lexer generator for Haskell, >= 2.0
Profile.hs -- BNFC source file (formats/profile), must be on your path

View File

@@ -10,11 +10,28 @@ int fact (int n) {
return f ;
} ;
int factr (int n) {
int f ;
{
if (n < 2) {
f = 1 ;
}
else {
f = n * factr (n-1) ;
}
}
return f ;
} ;
int main () {
int n ;
n = 1 ;
{
while (n < 11) printf("%d",fact(n)) ; n = n+1 ;
while (n < 11) {
printf("%d",fact(n)) ;
printf("%d",factr(n)) ;
n = n+1 ;
}
}
return ;
} ;

View File

@@ -1,4 +1,4 @@
./TestImperC $1 | tail -1 >gft.tmp
echo "es -file=typecheck.gfs" | gf+ -s Imper.gfcm
echo "es -file=typecheck.gfs" | gf -s Imper.gfcm
runhugs CleanJVM jvm.tmp $1
#rm *.tmp
rm *.tmp

View File

@@ -1,10 +1,10 @@
GF=gf+
GF=gf
SRC=../
all: compiler
compiler:
echo "pm | wf Imper.gfcm ;; pg -lang=ImperC -printer=lbnf | wf ImperC.tmp" | $(GF) $(SRC)ImperC.gf $(SRC)ImperJVM.gf
echo "pm | wf Imper.gfcm ;; pg -lang=ImperC -printer=plbnf | wf ImperC.tmp" | $(GF) $(SRC)ImperC.gf $(SRC)ImperJVM.gf
echo "entrypoints Program, Stm, Exp ;" >entry.tmp
cat entry.tmp ImperC.tmp >ImperC.cf
bnfc -m -prof ImperC.cf