-
Notifications
You must be signed in to change notification settings - Fork 8
Compiler
leithaus edited this page Sep 14, 2010
·
4 revisions
The web branch of this project adds a DSL and a compiler from the DSL to Scala source.
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import com.biosimilarity.lift.model._
import com.biosimilarity.lift.model._
import com.biosimilarity.lift.model._
scala> import specialK._
import specialK._
import specialK._
scala> import Absyn._
import Absyn._
import Absyn._
scala> import Eval._
import Eval._
import Eval._
scala> new REPL()
new REPL()
res0: com.biosimilarity.lift.model.REPL = com.biosimilarity.lift.model.REPL@1cf7b8fc
scala> res0.compile( "a( X )?( P ){ *P }" )
res0.compile( "a( X )?( P ){ *P }" )
res1: res0.theCompiler.Source = <source>{ object InputGuarded1122b4a5-38f8-47a7-8773-89a359e62c6e extends AgentExecutor { override def execute( tstore : TermStore ) = { val dummyff78cd10-43f0-4776-90d2-503caec4f8dc = tstore.get( new CnxnBranch[String,String]( a, new CnxnLeaf[String,String]( X ) ), ( subst76fdc27f-ca5e-44b6-8d46-6fed81b51a0b ) => { Some( RBound( Some( P ), unifyc9881a60-4336-4af5-b707-5c46ca99f342 ) ) = subst76fdc27f-ca5e-44b6-8d46-6fed81b51a0b ; unifyc9881a60-4336-4af5-b707-5c46ca99f342 match { case Some( substd724d40e-48ff-4b5e-8a26-24c536eee2f5 ) => { X = substd724d40e-48ff-4b5e-8a26-24c536eee2f5.get( "XX" ) ; { object Composition4184df24-d861-4811-81e7-f2d940a63574 extends AgentExecutor { override def execute( tstore : TermStore ) = { object Threadf8...
scala> println( res1.text )
println( res1.text )
{ object InputGuarded1122b4a5-38f8-47a7-8773-89a359e62c6e extends AgentExecutor { override def execute( tstore : TermStore ) = { val dummyff78cd10-43f0-4776-90d2-503caec4f8dc = tstore.get( new CnxnBranch[String,String]( a, new CnxnLeaf[String,String]( X ) ), ( subst76fdc27f-ca5e-44b6-8d46-6fed81b51a0b ) => { Some( RBound( Some( P ), unifyc9881a60-4336-4af5-b707-5c46ca99f342 ) ) = subst76fdc27f-ca5e-44b6-8d46-6fed81b51a0b ; unifyc9881a60-4336-4af5-b707-5c46ca99f342 match { case Some( substd724d40e-48ff-4b5e-8a26-24c536eee2f5 ) => { X = substd724d40e-48ff-4b5e-8a26-24c536eee2f5.get( "XX" ) ; { object Composition4184df24-d861-4811-81e7-f2d940a63574 extends AgentExecutor { override def execute( tstore : TermStore ) = { object Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d extends Thread { override def run() = { object Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f extends AgentExecutor { override def execute( tstore : TermStore ) = { P.execute( tstore ) } } ; Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f.execute( tstore ) } } ; Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d.run() ; } } ; Composition4184df24-d861-4811-81e7-f2d940a63574.execute( tstore ) } } case None => { { object Composition4184df24-d861-4811-81e7-f2d940a63574 extends AgentExecutor { override def execute( tstore : TermStore ) = { object Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d extends Thread { override def run() = { object Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f extends AgentExecutor { override def execute( tstore : TermStore ) = { P.execute( tstore ) } } ; Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f.execute( tstore ) } } ; Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d.run() ; } } ; Composition4184df24-d861-4811-81e7-f2d940a63574.execute( tstore ) } } } } ) } } ; InputGuarded1122b4a5-38f8-47a7-8773-89a359e62c6e.execute( tstore ) }
scala> :q
which when formatted a little more nicely looks like
{
object InputGuarded1122b4a5-38f8-47a7-8773-89a359e62c6e
extends AgentExecutor
{
override def execute( tstore : TermStore ) = {
val dummyff78cd10-43f0-4776-90d2-503caec4f8dc =
tstore.get(
new CnxnBranch[String,String](
a,
new CnxnLeaf[String,String]( X )
),
( subst76fdc27f-ca5e-44b6-8d46-6fed81b51a0b ) => {
Some(
RBound(
Some( P ),
unifyc9881a60-4336-4af5-b707-5c46ca99f342
)
) = subst76fdc27f-ca5e-44b6-8d46-6fed81b51a0b ;
unifyc9881a60-4336-4af5-b707-5c46ca99f342 match {
case Some( substd724d40e-48ff-4b5e-8a26-24c536eee2f5 )
=> {
X = substd724d40e-48ff-4b5e-8a26-24c536eee2f5.get( "XX" ) ;
{
object Composition4184df24-d861-4811-81e7-f2d940a63574
extends AgentExecutor
{
override def execute( tstore : TermStore ) = {
object Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d
extends Thread
{
override def run() = {
object Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f
extends AgentExecutor
{
override def execute( tstore : TermStore ) = {
P.execute( tstore )
}
} ;
Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f.execute(
tstore
)
}
} ;
Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d.run()
;
}
} ;
Composition4184df24-d861-4811-81e7-f2d940a63574.execute(
tstore
)
}
}
case None =>
{
{
object Composition4184df24-d861-4811-81e7-f2d940a63574
extends AgentExecutor
{
override def execute( tstore : TermStore ) = {
object Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d
extends Thread
{
override def run() = {
object Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f
extends AgentExecutor
{
override def execute( tstore : TermStore) = {
P.execute( tstore )
}
} ;
Replicationbccdb901-0569-41d5-abd5-ba912a3b9c5f.execute(
tstore
)
}
} ;
Threadf8d4b252-7010-4ce2-a4eb-809e3f026f2d.run() ;
}
} ;
Composition4184df24-d861-4811-81e7-f2d940a63574.execute(
tstore
)
}
}
}
}
)
}
} ;
InputGuarded1122b4a5-38f8-47a7-8773-89a359e62c6e.execute( tstore )
}