ASTNode.java
No OneTemporary

File Metadata

Created
Sat, Nov 21, 5:43 AM

ASTNode.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.xreate;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ASTNode{
public ASTNode acceptComputableVisitor(ComputableAnalysis visitor) throws NoSuchMethodException, IllegalAccessException, Throwable{
Method compute = visitor.getClass().getDeclaredMethod("ifComputable", this.getClass());
ASTNode v = (ASTNode) compute.invoke(visitor, this);
return new ASTValue(0);
}
}
class ASTAssignment extends ASTNode{
public ASTVar var;
public ASTExpression value;
}
class ASTExpression extends ASTNode{
ListMultimap <ASTFunction, ASTExpression> representation;
public List<ASTVar> getUsedVars(){
return Lists.newArrayList(); //stub
}
public ASTNode eval(Map<ASTVar, ASTNode> substitutions)
{return new ASTValue(0);} //stub
}
class ASTFunction extends ASTNode{
String representation;
int fpcount; //formal parameters count
}
class ASTValue extends ASTExpression{
public int representation;
public ASTValue(int source){
representation = source;
}
}
class ASTVar extends ASTExpression{
int id;
public static Map<ASTVar, ASTValue> substitute(List<ASTVar> vars)
{return Maps.newHashMap();}
public ASTVar(){
id =0;
}
}
/*
* fargs - formal args
*
*
*
*/
/*
*
*
* block (fargs, body-list)
* expression -: atom
* atom :- val, var
* assignment
* sequence
*
*/

Event Timeline