| 1 | (******************************************************************************* |
|---|
| 2 | Copyright 2008 Sun Microsystems, Inc., |
|---|
| 3 | 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 4 | All rights reserved. |
|---|
| 5 | |
|---|
| 6 | U.S. Government Rights - Commercial software. |
|---|
| 7 | Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 8 | license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 9 | |
|---|
| 10 | Use is subject to license terms. |
|---|
| 11 | |
|---|
| 12 | This distribution may include materials developed by third parties. |
|---|
| 13 | |
|---|
| 14 | Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 15 | trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 16 | ******************************************************************************) |
|---|
| 17 | |
|---|
| 18 | api DynamicSemantics |
|---|
| 19 | import Map.{...} |
|---|
| 20 | import Syntax.{...} |
|---|
| 21 | |
|---|
| 22 | (* Runtime value ***************************************************************) |
|---|
| 23 | trait RuntimeValue comprises { Val, FnValue } |
|---|
| 24 | getValue(): Value |
|---|
| 25 | toString(): String |
|---|
| 26 | toSource(): String |
|---|
| 27 | end |
|---|
| 28 | |
|---|
| 29 | object Val(v: Value) extends RuntimeValue end |
|---|
| 30 | |
|---|
| 31 | object FnValue(fun: FnExpr, sigma: Map[\String, RuntimeValue\]) extends RuntimeValue end |
|---|
| 32 | |
|---|
| 33 | (* Runtime value factories *****************************************************) |
|---|
| 34 | val(expr: Value): RuntimeValue |
|---|
| 35 | val(expr: FnExpr, sigma: Map[\String, RuntimeValue\]): RuntimeValue |
|---|
| 36 | |
|---|
| 37 | (* Initialize the helper table *) |
|---|
| 38 | initDynamic(): () |
|---|
| 39 | |
|---|
| 40 | (* Evaluate a given program. *) |
|---|
| 41 | opr VDASH(p: Program): RuntimeValue |
|---|
| 42 | |
|---|
| 43 | end |
|---|