Permalink
Browse files

Makefile and run script

  • Loading branch information...
zefhemel committed Mar 24, 2009
1 parent c1ad98a commit 8a76f7ca3187b69a96e6c598ed5ca4caa0cbebbe
Showing with 25 additions and 3 deletions.
  1. +11 −0 Makefile
  2. +6 −0 bindingtest.g
  3. +2 −2 core.pil
  4. +3 −0 gelly
  5. BIN pil.jar
  6. +3 −1 rewrite.pil
View
@@ -0,0 +1,11 @@
+gelly.jar: *.pil
+ rm -f *.pil.h
+ rm -rf .pil
+ pilc -i gelly.pil --java -d .pil
+ cd .pil && javac application/Main.java
+ cd .pil && jar cmf ../Manifest ../gelly.jar *
+
+clean:
+ rm -f *.pil.h
+ rm -rf .pil
+ rm -f gelly.jar
View
@@ -1,3 +1,8 @@
+![ 10 ];
+?[ `something ];
+strategy returnSomething()[] {
+ ![ `something ]
+};
strategy addone(s)[] {
?[ `t ];
s;
@@ -6,5 +11,6 @@ strategy addone(s)[] {
![ 17 ];
addone(?[ `frits ]);
debug;
+returnSomething;
try(addone(?[ `frits ]));
debug;
View
@@ -68,7 +68,7 @@ Bool gelly::rewrite::prim::strategyDef(Term t, Env env) {
valArgPassByValue = false;
}
}
- env.strategies[name] = new StrategyDef(strArgName, valArgName, valArgPassByValue, m["steps"]);
+ env.strategies[name] = new StrategyDef(env, strArgName, valArgName, valArgPassByValue, m["steps"]);
return true;
}
return false;
@@ -139,7 +139,7 @@ Bool gelly::rewrite::prim::strategyCall(Term t, Env env) {
if(env.strategies.contains(strategyName)) {
var str = env.strategies[strategyName];
- var newEnv = new Env(env.strategies.clone(), env.closureStrategies.clone(), new Map<String, Term>()); //env.bindings.clone()); //new Map<String, Term>());
+ var newEnv = new Env(str.env.strategies.clone(), str.env.closureStrategies.clone(), str.env.bindings.clone()); //);new Map<String, Term>()); //env.bindings.clone()); //new Map<String, Term>());
newEnv.currentTerm = env.currentTerm;
if(!(m["strparam"] instanceof EmptyTerm)) {
newEnv.closureStrategies[str.strArgName] = new ClosureStrategyDef(env, m["strparam"]);
View
3 gelly
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+java -jar gelly.jar $*
View
BIN pil.jar
Binary file not shown.
View
@@ -44,12 +44,14 @@ class gelly::rewrite::CouldNotInterpretException extends Exception {
}
class gelly::rewrite::StrategyDef {
+ Env env = null;
Term t = null;
String strArgName = null;
String valArgName = null;
Bool valArgPassByValue = true;
- new(String strArgName, String valArgName, Bool valArgPassByValue, Term t) {
+ new(Env env, String strArgName, String valArgName, Bool valArgPassByValue, Term t) {
+ this.env = env;
this.strArgName = strArgName;
this.valArgName = valArgName;
this.valArgPassByValue = valArgPassByValue;

0 comments on commit 8a76f7c

Please sign in to comment.