Mercurial > hg > graal-jvmci-8
diff 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 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SLNodeFactory.java Thu Jan 30 17:52:24 2014 -0800 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SLNodeFactory.java Thu Jan 30 17:53:27 2014 -0800 @@ -36,8 +36,17 @@ import com.oracle.truffle.sl.nodes.local.*; import com.oracle.truffle.sl.runtime.*; +/** + * Helper class used by the SL {@link Parser} to create nodes. The code is factored out of the + * automatically generated parser to keep the attributed grammar of SL small. + */ public class SLNodeFactory { + /** + * Local variable names that are visible in the current block. Variables are not visible outside + * of their defining block, to prevent the usage of undefined variables. Because of that, we can + * decide during parsing if a name references a local variable or is a function name. + */ static class LexicalScope { protected final LexicalScope outer; protected final Map<String, FrameSlot> locals;