Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java @ 22126:7d4e42092f39
Removing unused fields. Plus applying formatter which is able to make any comment undreadable.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Thu, 03 Sep 2015 16:17:00 +0200 |
parents | 8d2bdc802002 |
children | dc83cc1f94f2 ffadd23c63c8 3aad794eec0e |
comparison
equal
deleted
inserted
replaced
22125:8d2bdc802002 | 22126:7d4e42092f39 |
---|---|
37 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 37 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
38 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 38 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
39 * SOFTWARE. | 39 * SOFTWARE. |
40 */ | 40 */ |
41 package com.oracle.truffle.sl; | 41 package com.oracle.truffle.sl; |
42 | |
43 import java.io.*; | |
44 import java.math.*; | |
45 import java.util.*; | |
46 import java.util.Scanner; | |
47 | 42 |
48 import com.oracle.truffle.api.*; | 43 import com.oracle.truffle.api.*; |
49 import com.oracle.truffle.api.debug.*; | 44 import com.oracle.truffle.api.debug.*; |
50 import com.oracle.truffle.api.dsl.*; | 45 import com.oracle.truffle.api.dsl.*; |
51 import com.oracle.truffle.api.frame.*; | 46 import com.oracle.truffle.api.frame.*; |
61 import com.oracle.truffle.sl.nodes.expression.*; | 56 import com.oracle.truffle.sl.nodes.expression.*; |
62 import com.oracle.truffle.sl.nodes.instrument.*; | 57 import com.oracle.truffle.sl.nodes.instrument.*; |
63 import com.oracle.truffle.sl.nodes.local.*; | 58 import com.oracle.truffle.sl.nodes.local.*; |
64 import com.oracle.truffle.sl.parser.*; | 59 import com.oracle.truffle.sl.parser.*; |
65 import com.oracle.truffle.sl.runtime.*; | 60 import com.oracle.truffle.sl.runtime.*; |
61 import java.io.BufferedReader; | |
62 import java.io.IOException; | |
63 import java.io.InputStreamReader; | |
64 import java.io.PrintWriter; | |
65 import java.math.BigInteger; | |
66 import java.nio.file.Path; | 66 import java.nio.file.Path; |
67 import java.util.Collections; | |
68 import java.util.List; | |
67 | 69 |
68 /** | 70 /** |
69 * SL is a simple language to demonstrate and showcase features of Truffle. The implementation is as | 71 * SL is a simple language to demonstrate and showcase features of Truffle. The implementation is as |
70 * simple and clean as possible in order to help understanding the ideas and concepts of Truffle. | 72 * simple and clean as possible in order to help understanding the ideas and concepts of Truffle. |
71 * The language has first class functions, but no object model. | 73 * The language has first class functions, but no object model. |
135 * nanoseconds. | 137 * nanoseconds. |
136 * <li>{@link SLDefineFunctionBuiltin defineFunction}: Parses the functions provided as a String | 138 * <li>{@link SLDefineFunctionBuiltin defineFunction}: Parses the functions provided as a String |
137 * argument and adds them to the function registry. Functions that are already defined are replaced | 139 * argument and adds them to the function registry. Functions that are already defined are replaced |
138 * with the new version. | 140 * with the new version. |
139 * </ul> | 141 * </ul> |
140 * | 142 */ |
141 * <p> | 143 |
142 * <b>Tools:</b><br> | 144 /* |
143 * The use of some of Truffle's support for developer tools (based on the Truffle Instrumentation | 145 * |
144 * Framework) are demonstrated in this file, for example: | 146 * <p> <b>Tools:</b><br> The use of some of Truffle's support for developer tools (based on the |
145 * <ul> | 147 * Truffle Instrumentation Framework) are demonstrated in this file, for example: <ul> <li>a |
146 * <li>a {@linkplain NodeExecCounter counter for node executions}, tabulated by node type; and</li> | 148 * {@linkplain NodeExecCounter counter for node executions}, tabulated by node type; and</li> <li>a |
147 * <li>a simple {@linkplain CoverageTracker code coverage engine}.</li> | 149 * simple {@linkplain CoverageTracker code coverage engine}.</li> </ul> In each case, the tool is |
148 * </ul> | 150 * enabled if a corresponding local boolean variable in this file is set to {@code true}. Results |
149 * In each case, the tool is enabled if a corresponding local boolean variable in this file is set | 151 * are printed at the end of the execution using each tool's <em>default printer</em>. |
150 * to {@code true}. Results are printed at the end of the execution using each tool's | |
151 * <em>default printer</em>. | |
152 * | |
153 */ | 152 */ |
154 @TruffleLanguage.Registration(name = "SL", version = "0.5", mimeType = "application/x-sl") | 153 @TruffleLanguage.Registration(name = "SL", version = "0.5", mimeType = "application/x-sl") |
155 public final class SLLanguage extends TruffleLanguage<SLContext> { | 154 public final class SLLanguage extends TruffleLanguage<SLContext> { |
156 private static List<NodeFactory<? extends SLBuiltinNode>> builtins = Collections.emptyList(); | 155 private static List<NodeFactory<? extends SLBuiltinNode>> builtins = Collections.emptyList(); |
157 private static Visualizer visualizer = new SLDefaultVisualizer(); | 156 private static Visualizer visualizer = new SLDefaultVisualizer(); |
169 for (NodeFactory<? extends SLBuiltinNode> builtin : builtins) { | 168 for (NodeFactory<? extends SLBuiltinNode> builtin : builtins) { |
170 context.installBuiltin(builtin, true); | 169 context.installBuiltin(builtin, true); |
171 } | 170 } |
172 return context; | 171 return context; |
173 } | 172 } |
174 | |
175 // TODO (mlvdv) command line options | |
176 /* Enables demonstration of per-type tabulation of node execution counts */ | |
177 private static boolean nodeExecCounts = false; | |
178 /* Enables demonstration of per-line tabulation of STATEMENT node execution counts */ | |
179 private static boolean statementCounts = false; | |
180 /* Enables demonstration of per-line tabulation of STATEMENT coverage */ | |
181 private static boolean coverage = false; | |
182 | 173 |
183 /* Small tools that can be installed for demonstration */ | 174 /* Small tools that can be installed for demonstration */ |
184 // private static NodeExecCounter nodeExecCounter = null; | 175 // private static NodeExecCounter nodeExecCounter = null; |
185 // private static NodeExecCounter statementExecCounter = null; | 176 // private static NodeExecCounter statementExecCounter = null; |
186 // private static CoverageTracker coverageTracker = null; | 177 // private static CoverageTracker coverageTracker = null; |