Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F5335500
ASTNode.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 21, 5:43 AM
Size
1 KB
Mime Type
text/x-java
Expires
Mon, Nov 23, 5:43 AM (1 d, 4 h)
Engine
blob
Format
Raw Data
Handle
313390
Attached To
rXR Xreate
ASTNode.java
View Options
/*
* 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
Log In to Comment