comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SLNodeFactory.java @ 13836:64c77f0577bb

More documentation and improvements of Simple Language
author Christian Wimmer <christian.wimmer@oracle.com>
date Thu, 30 Jan 2014 17:53:27 -0800
parents b16ec83edc73
children 89ac75425681
comparison
equal deleted inserted replaced
13835:67e4e7f56911 13836:64c77f0577bb
34 import com.oracle.truffle.sl.nodes.controlflow.*; 34 import com.oracle.truffle.sl.nodes.controlflow.*;
35 import com.oracle.truffle.sl.nodes.expression.*; 35 import com.oracle.truffle.sl.nodes.expression.*;
36 import com.oracle.truffle.sl.nodes.local.*; 36 import com.oracle.truffle.sl.nodes.local.*;
37 import com.oracle.truffle.sl.runtime.*; 37 import com.oracle.truffle.sl.runtime.*;
38 38
39 /**
40 * Helper class used by the SL {@link Parser} to create nodes. The code is factored out of the
41 * automatically generated parser to keep the attributed grammar of SL small.
42 */
39 public class SLNodeFactory { 43 public class SLNodeFactory {
40 44
45 /**
46 * Local variable names that are visible in the current block. Variables are not visible outside
47 * of their defining block, to prevent the usage of undefined variables. Because of that, we can
48 * decide during parsing if a name references a local variable or is a function name.
49 */
41 static class LexicalScope { 50 static class LexicalScope {
42 protected final LexicalScope outer; 51 protected final LexicalScope outer;
43 protected final Map<String, FrameSlot> locals; 52 protected final Map<String, FrameSlot> locals;
44 53
45 public LexicalScope(LexicalScope outer) { 54 public LexicalScope(LexicalScope outer) {