[pypy-commit] benchmarks default: add a benchmark that parses E (the language) contributed by Allan Short (dash)

fijal noreply at buildbot.pypy.org
Mon Nov 5 19:13:28 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r191:f583699adf04
Date: 2012-11-05 20:13 +0200
http://bitbucket.org/pypy/benchmarks/changeset/f583699adf04/

Log:	add a benchmark that parses E (the language) contributed by Allan
	Short (dash)

diff too long, truncating to 2000 out of 9775 lines

diff --git a/benchmarks.py b/benchmarks.py
--- a/benchmarks.py
+++ b/benchmarks.py
@@ -42,6 +42,7 @@
 opts = {
     'gcbench' : {'iteration_scaling' : .10},
     'pidigits': {'iteration_scaling' : .10},
+    'eparse'  : {'bm_env': {'PYTHONPATH': relative('lib/monte')}},
     'bm_mako' : {'bm_env': {'PYTHONPATH': relative('lib/mako')}},
     'bm_chameleon': {'bm_env': {'PYTHONPATH': relative('lib/chameleon/src')},
                      'iteration_scaling': 3},
@@ -61,7 +62,7 @@
 for name in ['float', 'nbody_modified', 'meteor-contest', 'fannkuch',
              'spectral-norm', 'chaos', 'telco', 'go', 'pyflate-fast',
              'raytrace-simple', 'crypto_pyaes', 'bm_mako', 'bm_chameleon',
-             'json_bench', 'pidigits', 'hexiom2']:
+             'json_bench', 'pidigits', 'hexiom2', 'eparse']:
     _register_new_bm(name, name, globals(), **opts.get(name, {}))
 for name in ['names', 'iteration', 'tcp', 'pb', ]:#'web']:#, 'accepts']:
     if name == 'web':
diff --git a/lib/monte/monte/__init__.py b/lib/monte/monte/__init__.py
new file mode 100644
diff --git a/lib/monte/monte/common.py b/lib/monte/monte/common.py
new file mode 100644
--- /dev/null
+++ b/lib/monte/monte/common.py
@@ -0,0 +1,100 @@
+import string
+from monte.terml_nodes import termMaker
+
+baseGrammar = r"""
+horizontal_space = (' '|'\t'|'\f'|('#' (~eol anything)*))
+spaces = horizontal_space*
+
+number = spaces barenumber
+barenumber = '-'?:sign (('0' ((('x'|'X') hexdigit*:hs -> makeHex(sign, hs))
+                    |floatPart(sign '0')
+                    |octaldigit*:ds -> makeOctal(sign, ds)))
+               |decdigits:ds floatPart(sign, ds)
+               |decdigits:ds -> signedInt(sign, ds))
+
+
+exponent = <('e' | 'E') ('+' | '-')? decdigits>
+
+
+floatPart :sign :ds = <('.' decdigits exponent?) | exponent>:tail -> makeFloat(sign, ds, tail)
+
+decdigits = digit:d ((:x ?(isDigit(x)) -> x) | '_' -> "")*:ds -> concat(d, join(ds))
+octaldigit = :x ?(isOctDigit(x)) -> x
+hexdigit = :x ?(isHexDigit(x)) -> x
+
+string = token('"') (escapedChar | ~('"') anything)*:c '"' -> join(c)
+character = token("'") (escapedChar | ~('\''|'\n'|'\r'|'\\') anything):c '\'' -> Character(c)
+escapedUnicode = ('u' <hexdigit hexdigit hexdigit hexdigit>:hs -> unichr(int(hs, 16))
+                   |'U' <hexdigit hexdigit hexdigit hexdigit
+                         hexdigit hexdigit hexdigit hexdigit>:hs -> unichr(int(hs, 16)))
+
+escapedOctal = ( <:a ?(contains("0123", a)) octdigit? octdigit?>
+                 | <:a ?(contains("4567", a)) octdigit?>):os -> int(os, 8)
+
+escapedChar = '\\' ('n' -> '\n'
+                     |'r' -> '\r'
+                     |'t' -> '\t'
+                     |'b' -> '\b'
+                     |'f' -> '\f'
+                     |'"' -> '"'
+                     |'\'' -> '\''
+                     |'?' -> '?'
+                     |'\\' -> '\\'
+                     | escapedUnicode
+                     | escapedOctal
+                     | eol -> "")
+
+eol = horizontal_space* ('\r' '\n'|'\r' | '\n')
+
+uriBody = <(letterOrDigit |';'|'/'|'?'|':'|'@'|'&'|'='|'+'|'$'|','|'-'|'.'|'!'|'~'|'*'|'\''|'('|')'|'%'|'\\'|'|'|'#')+>
+
+"""
+
+
+def concat(*bits):
+    return ''.join(map(str, bits))
+
+Character = termMaker.Character
+
+def makeFloat(sign, ds, tail):
+        return float((sign or '') + ds + tail)
+
+def signedInt(sign, x, base=10):
+    return int(str((sign or '')+x), base)
+
+def join(x):
+    return ''.join(x)
+
+def makeHex(sign, hs):
+    return int((sign or '') + ''.join(hs), 16)
+
+def makeOctal(sign, ds):
+    return int((sign or '') + '0'+''.join(ds), 8)
+
+def isDigit(x):
+    return x in string.digits
+
+def isOctDigit(x):
+    return x in string.octdigits
+
+def isHexDigit(x):
+    return x in string.hexdigits
+
+def contains(container, value):
+    return value in container
+
+def cons(first, rest):
+    return [first] + rest
+
+
+def brk(x):
+    import pdb; pdb.set_trace()
+    return x
+
+try:
+    from monte.common_generated_fast import CommonParser
+    CommonParser.globals = globals()
+except ImportError:
+    from ometa.boot import BootOMetaGrammar
+    CommonParser = BootOMetaGrammar.makeGrammar(baseGrammar, globals(),
+                                                "CommonParser")
diff --git a/lib/monte/monte/common_generated.py b/lib/monte/monte/common_generated.py
new file mode 100644
--- /dev/null
+++ b/lib/monte/monte/common_generated.py
@@ -0,0 +1,702 @@
+from ometa.runtime import OMetaBase as GrammarBase
+class Parser(GrammarBase):
+    def rule_horizontal_space(self):
+        _locals = {'self': self}
+        self.locals['horizontal_space'] = _locals
+        def _G_or_1():
+            _G_exactly_2, lastError = self.exactly(' ')
+            self.considerError(lastError)
+            return (_G_exactly_2, self.currentError)
+        def _G_or_3():
+            _G_exactly_4, lastError = self.exactly('\t')
+            self.considerError(lastError)
+            return (_G_exactly_4, self.currentError)
+        def _G_or_5():
+            _G_exactly_6, lastError = self.exactly('\x0c')
+            self.considerError(lastError)
+            return (_G_exactly_6, self.currentError)
+        def _G_or_7():
+            _G_exactly_8, lastError = self.exactly('#')
+            self.considerError(lastError)
+            def _G_many_9():
+                def _G_not_10():
+                    _G_apply_11, lastError = self._apply(self.rule_eol, "eol", [])
+                    self.considerError(lastError)
+                    return (_G_apply_11, self.currentError)
+                _G_not_12, lastError = self._not(_G_not_10)
+                self.considerError(lastError)
+                _G_apply_13, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError)
+                return (_G_apply_13, self.currentError)
+            _G_many_14, lastError = self.many(_G_many_9)
+            self.considerError(lastError)
+            return (_G_many_14, self.currentError)
+        _G_or_15, lastError = self._or([_G_or_1, _G_or_3, _G_or_5, _G_or_7])
+        self.considerError(lastError)
+        return (_G_or_15, self.currentError)
+
+
+    def rule_spaces(self):
+        _locals = {'self': self}
+        self.locals['spaces'] = _locals
+        def _G_many_16():
+            _G_apply_17, lastError = self._apply(self.rule_horizontal_space, "horizontal_space", [])
+            self.considerError(lastError)
+            return (_G_apply_17, self.currentError)
+        _G_many_18, lastError = self.many(_G_many_16)
+        self.considerError(lastError)
+        return (_G_many_18, self.currentError)
+
+
+    def rule_number(self):
+        _locals = {'self': self}
+        self.locals['number'] = _locals
+        _G_apply_19, lastError = self._apply(self.rule_spaces, "spaces", [])
+        self.considerError(lastError)
+        _G_apply_20, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+        self.considerError(lastError)
+        return (_G_apply_20, self.currentError)
+
+
+    def rule_barenumber(self):
+        _locals = {'self': self}
+        self.locals['barenumber'] = _locals
+        def _G_optional_21():
+            _G_exactly_22, lastError = self.exactly('-')
+            self.considerError(lastError)
+            return (_G_exactly_22, self.currentError)
+        def _G_optional_23():
+            return (None, self.input.nullError())
+        _G_or_24, lastError = self._or([_G_optional_21, _G_optional_23])
+        self.considerError(lastError)
+        _locals['sign'] = _G_or_24
+        def _G_or_25():
+            _G_exactly_26, lastError = self.exactly('0')
+            self.considerError(lastError)
+            def _G_or_27():
+                def _G_or_28():
+                    _G_exactly_29, lastError = self.exactly('x')
+                    self.considerError(lastError)
+                    return (_G_exactly_29, self.currentError)
+                def _G_or_30():
+                    _G_exactly_31, lastError = self.exactly('X')
+                    self.considerError(lastError)
+                    return (_G_exactly_31, self.currentError)
+                _G_or_32, lastError = self._or([_G_or_28, _G_or_30])
+                self.considerError(lastError)
+                def _G_many_33():
+                    _G_apply_34, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    self.considerError(lastError)
+                    return (_G_apply_34, self.currentError)
+                _G_many_35, lastError = self.many(_G_many_33)
+                self.considerError(lastError)
+                _locals['hs'] = _G_many_35
+                _G_python_36, lastError = eval('makeHex(sign, hs)', self.globals, _locals), None
+                self.considerError(lastError)
+                return (_G_python_36, self.currentError)
+            def _G_or_37():
+                _G_python_38, lastError = eval('sign', self.globals, _locals), None
+                self.considerError(lastError)
+                _G_python_39, lastError = eval("'0'", self.globals, _locals), None
+                self.considerError(lastError)
+                _G_apply_40, lastError = self._apply(self.rule_floatPart, "floatPart", [_G_python_38, _G_python_39])
+                self.considerError(lastError)
+                return (_G_apply_40, self.currentError)
+            def _G_or_41():
+                def _G_many_42():
+                    _G_apply_43, lastError = self._apply(self.rule_octaldigit, "octaldigit", [])
+                    self.considerError(lastError)
+                    return (_G_apply_43, self.currentError)
+                _G_many_44, lastError = self.many(_G_many_42)
+                self.considerError(lastError)
+                _locals['ds'] = _G_many_44
+                _G_python_45, lastError = eval('makeOctal(sign, ds)', self.globals, _locals), None
+                self.considerError(lastError)
+                return (_G_python_45, self.currentError)
+            _G_or_46, lastError = self._or([_G_or_27, _G_or_37, _G_or_41])
+            self.considerError(lastError)
+            return (_G_or_46, self.currentError)
+        def _G_or_47():
+            _G_apply_48, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+            self.considerError(lastError)
+            _locals['ds'] = _G_apply_48
+            _G_python_49, lastError = eval('sign', self.globals, _locals), None
+            self.considerError(lastError)
+            _G_python_50, lastError = eval('ds', self.globals, _locals), None
+            self.considerError(lastError)
+            _G_apply_51, lastError = self._apply(self.rule_floatPart, "floatPart", [_G_python_49, _G_python_50])
+            self.considerError(lastError)
+            return (_G_apply_51, self.currentError)
+        def _G_or_52():
+            _G_apply_53, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+            self.considerError(lastError)
+            _locals['ds'] = _G_apply_53
+            _G_python_54, lastError = eval('signedInt(sign, ds)', self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_54, self.currentError)
+        _G_or_55, lastError = self._or([_G_or_25, _G_or_47, _G_or_52])
+        self.considerError(lastError)
+        return (_G_or_55, self.currentError)
+
+
+    def rule_exponent(self):
+        _locals = {'self': self}
+        self.locals['exponent'] = _locals
+        def _G_consumedby_56():
+            def _G_or_57():
+                _G_exactly_58, lastError = self.exactly('e')
+                self.considerError(lastError)
+                return (_G_exactly_58, self.currentError)
+            def _G_or_59():
+                _G_exactly_60, lastError = self.exactly('E')
+                self.considerError(lastError)
+                return (_G_exactly_60, self.currentError)
+            _G_or_61, lastError = self._or([_G_or_57, _G_or_59])
+            self.considerError(lastError)
+            def _G_optional_62():
+                def _G_or_63():
+                    _G_exactly_64, lastError = self.exactly('+')
+                    self.considerError(lastError)
+                    return (_G_exactly_64, self.currentError)
+                def _G_or_65():
+                    _G_exactly_66, lastError = self.exactly('-')
+                    self.considerError(lastError)
+                    return (_G_exactly_66, self.currentError)
+                _G_or_67, lastError = self._or([_G_or_63, _G_or_65])
+                self.considerError(lastError)
+                return (_G_or_67, self.currentError)
+            def _G_optional_68():
+                return (None, self.input.nullError())
+            _G_or_69, lastError = self._or([_G_optional_62, _G_optional_68])
+            self.considerError(lastError)
+            _G_apply_70, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+            self.considerError(lastError)
+            return (_G_apply_70, self.currentError)
+        _G_consumedby_71, lastError = self.consumedby(_G_consumedby_56)
+        self.considerError(lastError)
+        return (_G_consumedby_71, self.currentError)
+
+
+    def rule_floatPart(self):
+        _locals = {'self': self}
+        self.locals['floatPart'] = _locals
+        _G_apply_72, lastError = self._apply(self.rule_anything, "anything", [])
+        self.considerError(lastError)
+        _locals['sign'] = _G_apply_72
+        _G_apply_73, lastError = self._apply(self.rule_anything, "anything", [])
+        self.considerError(lastError)
+        _locals['ds'] = _G_apply_73
+        def _G_consumedby_74():
+            def _G_or_75():
+                _G_exactly_76, lastError = self.exactly('.')
+                self.considerError(lastError)
+                _G_apply_77, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+                self.considerError(lastError)
+                def _G_optional_78():
+                    _G_apply_79, lastError = self._apply(self.rule_exponent, "exponent", [])
+                    self.considerError(lastError)
+                    return (_G_apply_79, self.currentError)
+                def _G_optional_80():
+                    return (None, self.input.nullError())
+                _G_or_81, lastError = self._or([_G_optional_78, _G_optional_80])
+                self.considerError(lastError)
+                return (_G_or_81, self.currentError)
+            def _G_or_82():
+                _G_apply_83, lastError = self._apply(self.rule_exponent, "exponent", [])
+                self.considerError(lastError)
+                return (_G_apply_83, self.currentError)
+            _G_or_84, lastError = self._or([_G_or_75, _G_or_82])
+            self.considerError(lastError)
+            return (_G_or_84, self.currentError)
+        _G_consumedby_85, lastError = self.consumedby(_G_consumedby_74)
+        self.considerError(lastError)
+        _locals['tail'] = _G_consumedby_85
+        _G_python_86, lastError = eval('makeFloat(sign, ds, tail)', self.globals, _locals), None
+        self.considerError(lastError)
+        return (_G_python_86, self.currentError)
+
+
+    def rule_decdigits(self):
+        _locals = {'self': self}
+        self.locals['decdigits'] = _locals
+        _G_apply_87, lastError = self._apply(self.rule_digit, "digit", [])
+        self.considerError(lastError)
+        _locals['d'] = _G_apply_87
+        def _G_many_88():
+            def _G_or_89():
+                _G_apply_90, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError)
+                _locals['x'] = _G_apply_90
+                def _G_pred_91():
+                    _G_python_92, lastError = eval('isDigit(x)', self.globals, _locals), None
+                    self.considerError(lastError)
+                    return (_G_python_92, self.currentError)
+                _G_pred_93, lastError = self.pred(_G_pred_91)
+                self.considerError(lastError)
+                _G_python_94, lastError = eval('x', self.globals, _locals), None
+                self.considerError(lastError)
+                return (_G_python_94, self.currentError)
+            def _G_or_95():
+                _G_exactly_96, lastError = self.exactly('_')
+                self.considerError(lastError)
+                _G_python_97, lastError = eval('""', self.globals, _locals), None
+                self.considerError(lastError)
+                return (_G_python_97, self.currentError)
+            _G_or_98, lastError = self._or([_G_or_89, _G_or_95])
+            self.considerError(lastError)
+            return (_G_or_98, self.currentError)
+        _G_many_99, lastError = self.many(_G_many_88)
+        self.considerError(lastError)
+        _locals['ds'] = _G_many_99
+        _G_python_100, lastError = eval('concat(d, join(ds))', self.globals, _locals), None
+        self.considerError(lastError)
+        return (_G_python_100, self.currentError)
+
+
+    def rule_octaldigit(self):
+        _locals = {'self': self}
+        self.locals['octaldigit'] = _locals
+        _G_apply_101, lastError = self._apply(self.rule_anything, "anything", [])
+        self.considerError(lastError)
+        _locals['x'] = _G_apply_101
+        def _G_pred_102():
+            _G_python_103, lastError = eval('isOctDigit(x)', self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_103, self.currentError)
+        _G_pred_104, lastError = self.pred(_G_pred_102)
+        self.considerError(lastError)
+        _G_python_105, lastError = eval('x', self.globals, _locals), None
+        self.considerError(lastError)
+        return (_G_python_105, self.currentError)
+
+
+    def rule_hexdigit(self):
+        _locals = {'self': self}
+        self.locals['hexdigit'] = _locals
+        _G_apply_106, lastError = self._apply(self.rule_anything, "anything", [])
+        self.considerError(lastError)
+        _locals['x'] = _G_apply_106
+        def _G_pred_107():
+            _G_python_108, lastError = eval('isHexDigit(x)', self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_108, self.currentError)
+        _G_pred_109, lastError = self.pred(_G_pred_107)
+        self.considerError(lastError)
+        _G_python_110, lastError = eval('x', self.globals, _locals), None
+        self.considerError(lastError)
+        return (_G_python_110, self.currentError)
+
+
+    def rule_string(self):
+        _locals = {'self': self}
+        self.locals['string'] = _locals
+        _G_python_111, lastError = eval('\'"\'', self.globals, _locals), None
+        self.considerError(lastError)
+        _G_apply_112, lastError = self._apply(self.rule_token, "token", [_G_python_111])
+        self.considerError(lastError)
+        def _G_many_113():
+            def _G_or_114():
+                _G_apply_115, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                self.considerError(lastError)
+                return (_G_apply_115, self.currentError)
+            def _G_or_116():
+                def _G_not_117():
+                    _G_exactly_118, lastError = self.exactly('"')
+                    self.considerError(lastError)
+                    return (_G_exactly_118, self.currentError)
+                _G_not_119, lastError = self._not(_G_not_117)
+                self.considerError(lastError)
+                _G_apply_120, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError)
+                return (_G_apply_120, self.currentError)
+            _G_or_121, lastError = self._or([_G_or_114, _G_or_116])
+            self.considerError(lastError)
+            return (_G_or_121, self.currentError)
+        _G_many_122, lastError = self.many(_G_many_113)
+        self.considerError(lastError)
+        _locals['c'] = _G_many_122
+        _G_exactly_123, lastError = self.exactly('"')
+        self.considerError(lastError)
+        _G_python_124, lastError = eval('join(c)', self.globals, _locals), None
+        self.considerError(lastError)
+        return (_G_python_124, self.currentError)
+
+
+    def rule_character(self):
+        _locals = {'self': self}
+        self.locals['character'] = _locals
+        _G_python_125, lastError = eval('"\'"', self.globals, _locals), None
+        self.considerError(lastError)
+        _G_apply_126, lastError = self._apply(self.rule_token, "token", [_G_python_125])
+        self.considerError(lastError)
+        def _G_or_127():
+            _G_apply_128, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+            self.considerError(lastError)
+            return (_G_apply_128, self.currentError)
+        def _G_or_129():
+            def _G_not_130():
+                def _G_or_131():
+                    _G_exactly_132, lastError = self.exactly("'")
+                    self.considerError(lastError)
+                    return (_G_exactly_132, self.currentError)
+                def _G_or_133():
+                    _G_exactly_134, lastError = self.exactly('\n')
+                    self.considerError(lastError)
+                    return (_G_exactly_134, self.currentError)
+                def _G_or_135():
+                    _G_exactly_136, lastError = self.exactly('\r')
+                    self.considerError(lastError)
+                    return (_G_exactly_136, self.currentError)
+                def _G_or_137():
+                    _G_exactly_138, lastError = self.exactly('\\')
+                    self.considerError(lastError)
+                    return (_G_exactly_138, self.currentError)
+                _G_or_139, lastError = self._or([_G_or_131, _G_or_133, _G_or_135, _G_or_137])
+                self.considerError(lastError)
+                return (_G_or_139, self.currentError)
+            _G_not_140, lastError = self._not(_G_not_130)
+            self.considerError(lastError)
+            _G_apply_141, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError)
+            return (_G_apply_141, self.currentError)
+        _G_or_142, lastError = self._or([_G_or_127, _G_or_129])
+        self.considerError(lastError)
+        _locals['c'] = _G_or_142
+        _G_exactly_143, lastError = self.exactly("'")
+        self.considerError(lastError)
+        _G_python_144, lastError = eval('Character(c)', self.globals, _locals), None
+        self.considerError(lastError)
+        return (_G_python_144, self.currentError)
+
+
+    def rule_escapedUnicode(self):
+        _locals = {'self': self}
+        self.locals['escapedUnicode'] = _locals
+        def _G_or_145():
+            _G_exactly_146, lastError = self.exactly('u')
+            self.considerError(lastError)
+            def _G_consumedby_147():
+                _G_apply_148, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_149, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_150, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_151, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                return (_G_apply_151, self.currentError)
+            _G_consumedby_152, lastError = self.consumedby(_G_consumedby_147)
+            self.considerError(lastError)
+            _locals['hs'] = _G_consumedby_152
+            _G_python_153, lastError = eval('unichr(int(hs, 16))', self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_153, self.currentError)
+        def _G_or_154():
+            _G_exactly_155, lastError = self.exactly('U')
+            self.considerError(lastError)
+            def _G_consumedby_156():
+                _G_apply_157, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_158, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_159, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_160, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_161, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_162, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_163, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                _G_apply_164, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                self.considerError(lastError)
+                return (_G_apply_164, self.currentError)
+            _G_consumedby_165, lastError = self.consumedby(_G_consumedby_156)
+            self.considerError(lastError)
+            _locals['hs'] = _G_consumedby_165
+            _G_python_166, lastError = eval('unichr(int(hs, 16))', self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_166, self.currentError)
+        _G_or_167, lastError = self._or([_G_or_145, _G_or_154])
+        self.considerError(lastError)
+        return (_G_or_167, self.currentError)
+
+
+    def rule_escapedOctal(self):
+        _locals = {'self': self}
+        self.locals['escapedOctal'] = _locals
+        def _G_or_168():
+            def _G_consumedby_169():
+                _G_apply_170, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError)
+                _locals['a'] = _G_apply_170
+                def _G_pred_171():
+                    _G_python_172, lastError = eval('contains("0123", a)', self.globals, _locals), None
+                    self.considerError(lastError)
+                    return (_G_python_172, self.currentError)
+                _G_pred_173, lastError = self.pred(_G_pred_171)
+                self.considerError(lastError)
+                def _G_optional_174():
+                    _G_apply_175, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                    self.considerError(lastError)
+                    return (_G_apply_175, self.currentError)
+                def _G_optional_176():
+                    return (None, self.input.nullError())
+                _G_or_177, lastError = self._or([_G_optional_174, _G_optional_176])
+                self.considerError(lastError)
+                def _G_optional_178():
+                    _G_apply_179, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                    self.considerError(lastError)
+                    return (_G_apply_179, self.currentError)
+                def _G_optional_180():
+                    return (None, self.input.nullError())
+                _G_or_181, lastError = self._or([_G_optional_178, _G_optional_180])
+                self.considerError(lastError)
+                return (_G_or_181, self.currentError)
+            _G_consumedby_182, lastError = self.consumedby(_G_consumedby_169)
+            self.considerError(lastError)
+            return (_G_consumedby_182, self.currentError)
+        def _G_or_183():
+            def _G_consumedby_184():
+                _G_apply_185, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError)
+                _locals['a'] = _G_apply_185
+                def _G_pred_186():
+                    _G_python_187, lastError = eval('contains("4567", a)', self.globals, _locals), None
+                    self.considerError(lastError)
+                    return (_G_python_187, self.currentError)
+                _G_pred_188, lastError = self.pred(_G_pred_186)
+                self.considerError(lastError)
+                def _G_optional_189():
+                    _G_apply_190, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                    self.considerError(lastError)
+                    return (_G_apply_190, self.currentError)
+                def _G_optional_191():
+                    return (None, self.input.nullError())
+                _G_or_192, lastError = self._or([_G_optional_189, _G_optional_191])
+                self.considerError(lastError)
+                return (_G_or_192, self.currentError)
+            _G_consumedby_193, lastError = self.consumedby(_G_consumedby_184)
+            self.considerError(lastError)
+            return (_G_consumedby_193, self.currentError)
+        _G_or_194, lastError = self._or([_G_or_168, _G_or_183])
+        self.considerError(lastError)
+        _locals['os'] = _G_or_194
+        _G_python_195, lastError = eval('int(os, 8)', self.globals, _locals), None
+        self.considerError(lastError)
+        return (_G_python_195, self.currentError)
+
+
+    def rule_escapedChar(self):
+        _locals = {'self': self}
+        self.locals['escapedChar'] = _locals
+        _G_exactly_196, lastError = self.exactly('\\')
+        self.considerError(lastError)
+        def _G_or_197():
+            _G_exactly_198, lastError = self.exactly('n')
+            self.considerError(lastError)
+            _G_python_199, lastError = eval("'\\n'", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_199, self.currentError)
+        def _G_or_200():
+            _G_exactly_201, lastError = self.exactly('r')
+            self.considerError(lastError)
+            _G_python_202, lastError = eval("'\\r'", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_202, self.currentError)
+        def _G_or_203():
+            _G_exactly_204, lastError = self.exactly('t')
+            self.considerError(lastError)
+            _G_python_205, lastError = eval("'\\t'", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_205, self.currentError)
+        def _G_or_206():
+            _G_exactly_207, lastError = self.exactly('b')
+            self.considerError(lastError)
+            _G_python_208, lastError = eval("'\\b'", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_208, self.currentError)
+        def _G_or_209():
+            _G_exactly_210, lastError = self.exactly('f')
+            self.considerError(lastError)
+            _G_python_211, lastError = eval("'\\f'", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_211, self.currentError)
+        def _G_or_212():
+            _G_exactly_213, lastError = self.exactly('"')
+            self.considerError(lastError)
+            _G_python_214, lastError = eval('\'"\'', self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_214, self.currentError)
+        def _G_or_215():
+            _G_exactly_216, lastError = self.exactly("'")
+            self.considerError(lastError)
+            _G_python_217, lastError = eval("'\\''", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_217, self.currentError)
+        def _G_or_218():
+            _G_exactly_219, lastError = self.exactly('?')
+            self.considerError(lastError)
+            _G_python_220, lastError = eval("'?'", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_220, self.currentError)
+        def _G_or_221():
+            _G_exactly_222, lastError = self.exactly('\\')
+            self.considerError(lastError)
+            _G_python_223, lastError = eval("'\\\\'", self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_223, self.currentError)
+        def _G_or_224():
+            _G_apply_225, lastError = self._apply(self.rule_escapedUnicode, "escapedUnicode", [])
+            self.considerError(lastError)
+            return (_G_apply_225, self.currentError)
+        def _G_or_226():
+            _G_apply_227, lastError = self._apply(self.rule_escapedOctal, "escapedOctal", [])
+            self.considerError(lastError)
+            return (_G_apply_227, self.currentError)
+        def _G_or_228():
+            _G_apply_229, lastError = self._apply(self.rule_eol, "eol", [])
+            self.considerError(lastError)
+            _G_python_230, lastError = eval('""', self.globals, _locals), None
+            self.considerError(lastError)
+            return (_G_python_230, self.currentError)
+        _G_or_231, lastError = self._or([_G_or_197, _G_or_200, _G_or_203, _G_or_206, _G_or_209, _G_or_212, _G_or_215, _G_or_218, _G_or_221, _G_or_224, _G_or_226, _G_or_228])
+        self.considerError(lastError)
+        return (_G_or_231, self.currentError)
+
+
+    def rule_eol(self):
+        _locals = {'self': self}
+        self.locals['eol'] = _locals
+        def _G_many_232():
+            _G_apply_233, lastError = self._apply(self.rule_horizontal_space, "horizontal_space", [])
+            self.considerError(lastError)
+            return (_G_apply_233, self.currentError)
+        _G_many_234, lastError = self.many(_G_many_232)
+        self.considerError(lastError)
+        def _G_or_235():
+            _G_exactly_236, lastError = self.exactly('\r')
+            self.considerError(lastError)
+            _G_exactly_237, lastError = self.exactly('\n')
+            self.considerError(lastError)
+            return (_G_exactly_237, self.currentError)
+        def _G_or_238():
+            _G_exactly_239, lastError = self.exactly('\r')
+            self.considerError(lastError)
+            return (_G_exactly_239, self.currentError)
+        def _G_or_240():
+            _G_exactly_241, lastError = self.exactly('\n')
+            self.considerError(lastError)
+            return (_G_exactly_241, self.currentError)
+        _G_or_242, lastError = self._or([_G_or_235, _G_or_238, _G_or_240])
+        self.considerError(lastError)
+        return (_G_or_242, self.currentError)
+
+
+    def rule_uriBody(self):
+        _locals = {'self': self}
+        self.locals['uriBody'] = _locals
+        def _G_consumedby_243():
+            def _G_many1_244():
+                def _G_or_245():
+                    _G_apply_246, lastError = self._apply(self.rule_letterOrDigit, "letterOrDigit", [])
+                    self.considerError(lastError)
+                    return (_G_apply_246, self.currentError)
+                def _G_or_247():
+                    _G_exactly_248, lastError = self.exactly(';')
+                    self.considerError(lastError)
+                    return (_G_exactly_248, self.currentError)
+                def _G_or_249():
+                    _G_exactly_250, lastError = self.exactly('/')
+                    self.considerError(lastError)
+                    return (_G_exactly_250, self.currentError)
+                def _G_or_251():
+                    _G_exactly_252, lastError = self.exactly('?')
+                    self.considerError(lastError)
+                    return (_G_exactly_252, self.currentError)
+                def _G_or_253():
+                    _G_exactly_254, lastError = self.exactly(':')
+                    self.considerError(lastError)
+                    return (_G_exactly_254, self.currentError)
+                def _G_or_255():
+                    _G_exactly_256, lastError = self.exactly('@')
+                    self.considerError(lastError)
+                    return (_G_exactly_256, self.currentError)
+                def _G_or_257():
+                    _G_exactly_258, lastError = self.exactly('&')
+                    self.considerError(lastError)
+                    return (_G_exactly_258, self.currentError)
+                def _G_or_259():
+                    _G_exactly_260, lastError = self.exactly('=')
+                    self.considerError(lastError)
+                    return (_G_exactly_260, self.currentError)
+                def _G_or_261():
+                    _G_exactly_262, lastError = self.exactly('+')
+                    self.considerError(lastError)
+                    return (_G_exactly_262, self.currentError)
+                def _G_or_263():
+                    _G_exactly_264, lastError = self.exactly('$')
+                    self.considerError(lastError)
+                    return (_G_exactly_264, self.currentError)
+                def _G_or_265():
+                    _G_exactly_266, lastError = self.exactly(',')
+                    self.considerError(lastError)
+                    return (_G_exactly_266, self.currentError)
+                def _G_or_267():
+                    _G_exactly_268, lastError = self.exactly('-')
+                    self.considerError(lastError)
+                    return (_G_exactly_268, self.currentError)
+                def _G_or_269():
+                    _G_exactly_270, lastError = self.exactly('.')
+                    self.considerError(lastError)
+                    return (_G_exactly_270, self.currentError)
+                def _G_or_271():
+                    _G_exactly_272, lastError = self.exactly('!')
+                    self.considerError(lastError)
+                    return (_G_exactly_272, self.currentError)
+                def _G_or_273():
+                    _G_exactly_274, lastError = self.exactly('~')
+                    self.considerError(lastError)
+                    return (_G_exactly_274, self.currentError)
+                def _G_or_275():
+                    _G_exactly_276, lastError = self.exactly('*')
+                    self.considerError(lastError)
+                    return (_G_exactly_276, self.currentError)
+                def _G_or_277():
+                    _G_exactly_278, lastError = self.exactly("'")
+                    self.considerError(lastError)
+                    return (_G_exactly_278, self.currentError)
+                def _G_or_279():
+                    _G_exactly_280, lastError = self.exactly('(')
+                    self.considerError(lastError)
+                    return (_G_exactly_280, self.currentError)
+                def _G_or_281():
+                    _G_exactly_282, lastError = self.exactly(')')
+                    self.considerError(lastError)
+                    return (_G_exactly_282, self.currentError)
+                def _G_or_283():
+                    _G_exactly_284, lastError = self.exactly('%')
+                    self.considerError(lastError)
+                    return (_G_exactly_284, self.currentError)
+                def _G_or_285():
+                    _G_exactly_286, lastError = self.exactly('\\')
+                    self.considerError(lastError)
+                    return (_G_exactly_286, self.currentError)
+                def _G_or_287():
+                    _G_exactly_288, lastError = self.exactly('|')
+                    self.considerError(lastError)
+                    return (_G_exactly_288, self.currentError)
+                def _G_or_289():
+                    _G_exactly_290, lastError = self.exactly('#')
+                    self.considerError(lastError)
+                    return (_G_exactly_290, self.currentError)
+                _G_or_291, lastError = self._or([_G_or_245, _G_or_247, _G_or_249, _G_or_251, _G_or_253, _G_or_255, _G_or_257, _G_or_259, _G_or_261, _G_or_263, _G_or_265, _G_or_267, _G_or_269, _G_or_271, _G_or_273, _G_or_275, _G_or_277, _G_or_279, _G_or_281, _G_or_283, _G_or_285, _G_or_287, _G_or_289])
+                self.considerError(lastError)
+                return (_G_or_291, self.currentError)
+            _G_many1_292, lastError = self.many(_G_many1_244, _G_many1_244())
+            self.considerError(lastError)
+            return (_G_many1_292, self.currentError)
+        _G_consumedby_293, lastError = self.consumedby(_G_consumedby_243)
+        self.considerError(lastError)
+        return (_G_consumedby_293, self.currentError)
diff --git a/lib/monte/monte/common_generated_fast.py b/lib/monte/monte/common_generated_fast.py
new file mode 100644
--- /dev/null
+++ b/lib/monte/monte/common_generated_fast.py
@@ -0,0 +1,514 @@
+from ometa.runtime import OMetaBase as GrammarBase
+class CommonParser(GrammarBase):
+    def rule_horizontal_space(self):
+        _locals = {'self': self}
+        self.locals['horizontal_space'] = _locals
+        def _G_or_1():
+            _G_exactly_2, lastError = self.exactly(' ')
+            return (_G_exactly_2, self.currentError)
+        def _G_or_3():
+            _G_exactly_4, lastError = self.exactly('\t')
+            return (_G_exactly_4, self.currentError)
+        def _G_or_5():
+            _G_exactly_6, lastError = self.exactly('\x0c')
+            return (_G_exactly_6, self.currentError)
+        def _G_or_7():
+            _G_exactly_8, lastError = self.exactly('#')
+            def _G_many_9():
+                def _G_not_10():
+                    _G_apply_11, lastError = self._apply(self.rule_eol, "eol", [])
+                    return (_G_apply_11, self.currentError)
+                _G_not_12, lastError = self._not(_G_not_10)
+                _G_apply_13, lastError = self._apply(self.rule_anything, "anything", [])
+                return (_G_apply_13, self.currentError)
+            _G_many_14, lastError = self.many(_G_many_9)
+            return (_G_many_14, self.currentError)
+        _G_or_15, lastError = self._or([_G_or_1, _G_or_3, _G_or_5, _G_or_7])
+        return (_G_or_15, self.currentError)
+
+
+    def rule_spaces(self):
+        _locals = {'self': self}
+        self.locals['spaces'] = _locals
+        def _G_many_16():
+            _G_apply_17, lastError = self._apply(self.rule_horizontal_space, "horizontal_space", [])
+            return (_G_apply_17, self.currentError)
+        _G_many_18, lastError = self.many(_G_many_16)
+        return (_G_many_18, self.currentError)
+
+
+    def rule_number(self):
+        _locals = {'self': self}
+        self.locals['number'] = _locals
+        _G_apply_19, lastError = self._apply(self.rule_spaces, "spaces", [])
+        _G_apply_20, lastError = self._apply(self.rule_barenumber, "barenumber", [])
+        return (_G_apply_20, self.currentError)
+
+
+    def rule_barenumber(self):
+        _locals = {'self': self}
+        self.locals['barenumber'] = _locals
+        def _G_optional_21():
+            _G_exactly_22, lastError = self.exactly('-')
+            return (_G_exactly_22, self.currentError)
+        def _G_optional_23():
+            return (None, self.input.nullError())
+        _G_or_24, lastError = self._or([_G_optional_21, _G_optional_23])
+        _locals['sign'] = _G_or_24
+        def _G_or_25():
+            _G_exactly_26, lastError = self.exactly('0')
+            def _G_or_27():
+                def _G_or_28():
+                    _G_exactly_29, lastError = self.exactly('x')
+                    return (_G_exactly_29, self.currentError)
+                def _G_or_30():
+                    _G_exactly_31, lastError = self.exactly('X')
+                    return (_G_exactly_31, self.currentError)
+                _G_or_32, lastError = self._or([_G_or_28, _G_or_30])
+                def _G_many_33():
+                    _G_apply_34, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                    return (_G_apply_34, self.currentError)
+                _G_many_35, lastError = self.many(_G_many_33)
+                _locals['hs'] = _G_many_35
+                _G_python_36, lastError = eval('makeHex(sign, hs)', self.globals, _locals), None
+                return (_G_python_36, self.currentError)
+            def _G_or_37():
+                _G_python_38, lastError = eval('sign', self.globals, _locals), None
+                _G_python_39, lastError = '0', None
+                _G_apply_40, lastError = self._apply(self.rule_floatPart, "floatPart", [_G_python_38, _G_python_39])
+                return (_G_apply_40, self.currentError)
+            def _G_or_41():
+                def _G_many_42():
+                    _G_apply_43, lastError = self._apply(self.rule_octaldigit, "octaldigit", [])
+                    return (_G_apply_43, self.currentError)
+                _G_many_44, lastError = self.many(_G_many_42)
+                _locals['ds'] = _G_many_44
+                _G_python_45, lastError = eval('makeOctal(sign, ds)', self.globals, _locals), None
+                return (_G_python_45, self.currentError)
+            _G_or_46, lastError = self._or([_G_or_27, _G_or_37, _G_or_41])
+            return (_G_or_46, self.currentError)
+        def _G_or_47():
+            _G_apply_48, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+            _locals['ds'] = _G_apply_48
+            _G_python_49, lastError = eval('sign,', self.globals, _locals), None
+            _G_python_50, lastError = eval('ds', self.globals, _locals), None
+            _G_apply_51, lastError = self._apply(self.rule_floatPart, "floatPart", [_G_python_49, _G_python_50])
+            return (_G_apply_51, self.currentError)
+        def _G_or_52():
+            _G_apply_53, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+            _locals['ds'] = _G_apply_53
+            _G_python_54, lastError = eval('signedInt(sign, ds)', self.globals, _locals), None
+            return (_G_python_54, self.currentError)
+        _G_or_55, lastError = self._or([_G_or_25, _G_or_47, _G_or_52])
+        return (_G_or_55, self.currentError)
+
+
+    def rule_exponent(self):
+        _locals = {'self': self}
+        self.locals['exponent'] = _locals
+        def _G_consumedby_56():
+            def _G_or_57():
+                _G_exactly_58, lastError = self.exactly('e')
+                return (_G_exactly_58, self.currentError)
+            def _G_or_59():
+                _G_exactly_60, lastError = self.exactly('E')
+                return (_G_exactly_60, self.currentError)
+            _G_or_61, lastError = self._or([_G_or_57, _G_or_59])
+            def _G_optional_62():
+                def _G_or_63():
+                    _G_exactly_64, lastError = self.exactly('+')
+                    return (_G_exactly_64, self.currentError)
+                def _G_or_65():
+                    _G_exactly_66, lastError = self.exactly('-')
+                    return (_G_exactly_66, self.currentError)
+                _G_or_67, lastError = self._or([_G_or_63, _G_or_65])
+                return (_G_or_67, self.currentError)
+            def _G_optional_68():
+                return (None, self.input.nullError())
+            _G_or_69, lastError = self._or([_G_optional_62, _G_optional_68])
+            _G_apply_70, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+            return (_G_apply_70, self.currentError)
+        _G_consumedby_71, lastError = self.consumedby(_G_consumedby_56)
+        return (_G_consumedby_71, self.currentError)
+
+
+    def rule_floatPart(self):
+        _locals = {'self': self}
+        self.locals['floatPart'] = _locals
+        _G_apply_72, lastError = self._apply(self.rule_anything, "anything", [])
+        _locals['sign'] = _G_apply_72
+        _G_apply_73, lastError = self._apply(self.rule_anything, "anything", [])
+        _locals['ds'] = _G_apply_73
+        def _G_consumedby_74():
+            def _G_or_75():
+                _G_exactly_76, lastError = self.exactly('.')
+                _G_apply_77, lastError = self._apply(self.rule_decdigits, "decdigits", [])
+                def _G_optional_78():
+                    _G_apply_79, lastError = self._apply(self.rule_exponent, "exponent", [])
+                    return (_G_apply_79, self.currentError)
+                def _G_optional_80():
+                    return (None, self.input.nullError())
+                _G_or_81, lastError = self._or([_G_optional_78, _G_optional_80])
+                return (_G_or_81, self.currentError)
+            def _G_or_82():
+                _G_apply_83, lastError = self._apply(self.rule_exponent, "exponent", [])
+                return (_G_apply_83, self.currentError)
+            _G_or_84, lastError = self._or([_G_or_75, _G_or_82])
+            return (_G_or_84, self.currentError)
+        _G_consumedby_85, lastError = self.consumedby(_G_consumedby_74)
+        _locals['tail'] = _G_consumedby_85
+        _G_python_86, lastError = eval('makeFloat(sign, ds, tail)', self.globals, _locals), None
+        return (_G_python_86, self.currentError)
+
+
+    def rule_decdigits(self):
+        _locals = {'self': self}
+        self.locals['decdigits'] = _locals
+        _G_apply_87, lastError = self._apply(self.rule_digit, "digit", [])
+        _locals['d'] = _G_apply_87
+        def _G_many_88():
+            def _G_or_89():
+                _G_apply_90, lastError = self._apply(self.rule_anything, "anything", [])
+                _locals['x'] = _G_apply_90
+                def _G_pred_91():
+                    _G_python_92, lastError = eval('isDigit(x)', self.globals, _locals), None
+                    return (_G_python_92, self.currentError)
+                _G_pred_93, lastError = self.pred(_G_pred_91)
+                _G_python_94, lastError = eval('x', self.globals, _locals), None
+                return (_G_python_94, self.currentError)
+            def _G_or_95():
+                _G_exactly_96, lastError = self.exactly('_')
+                _G_python_97, lastError = "", None
+                return (_G_python_97, self.currentError)
+            _G_or_98, lastError = self._or([_G_or_89, _G_or_95])
+            return (_G_or_98, self.currentError)
+        _G_many_99, lastError = self.many(_G_many_88)
+        _locals['ds'] = _G_many_99
+        _G_python_100, lastError = eval('concat(d, join(ds))', self.globals, _locals), None
+        return (_G_python_100, self.currentError)
+
+
+    def rule_octaldigit(self):
+        _locals = {'self': self}
+        self.locals['octaldigit'] = _locals
+        _G_apply_101, lastError = self._apply(self.rule_anything, "anything", [])
+        _locals['x'] = _G_apply_101
+        def _G_pred_102():
+            _G_python_103, lastError = eval('isOctDigit(x)', self.globals, _locals), None
+            return (_G_python_103, self.currentError)
+        _G_pred_104, lastError = self.pred(_G_pred_102)
+        _G_python_105, lastError = eval('x', self.globals, _locals), None
+        return (_G_python_105, self.currentError)
+
+
+    def rule_hexdigit(self):
+        _locals = {'self': self}
+        self.locals['hexdigit'] = _locals
+        _G_apply_106, lastError = self._apply(self.rule_anything, "anything", [])
+        _locals['x'] = _G_apply_106
+        def _G_pred_107():
+            _G_python_108, lastError = eval('isHexDigit(x)', self.globals, _locals), None
+            return (_G_python_108, self.currentError)
+        _G_pred_109, lastError = self.pred(_G_pred_107)
+        _G_python_110, lastError = eval('x', self.globals, _locals), None
+        return (_G_python_110, self.currentError)
+
+
+    def rule_string(self):
+        _locals = {'self': self}
+        self.locals['string'] = _locals
+        _G_python_111, lastError = '"', None
+        _G_apply_112, lastError = self._apply(self.rule_token, "token", [_G_python_111])
+        def _G_many_113():
+            def _G_or_114():
+                _G_apply_115, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+                return (_G_apply_115, self.currentError)
+            def _G_or_116():
+                def _G_not_117():
+                    _G_exactly_118, lastError = self.exactly('"')
+                    return (_G_exactly_118, self.currentError)
+                _G_not_119, lastError = self._not(_G_not_117)
+                _G_apply_120, lastError = self._apply(self.rule_anything, "anything", [])
+                return (_G_apply_120, self.currentError)
+            _G_or_121, lastError = self._or([_G_or_114, _G_or_116])
+            return (_G_or_121, self.currentError)
+        _G_many_122, lastError = self.many(_G_many_113)
+        _locals['c'] = _G_many_122
+        _G_exactly_123, lastError = self.exactly('"')
+        _G_python_124, lastError = eval('join(c)', self.globals, _locals), None
+        return (_G_python_124, self.currentError)
+
+
+    def rule_character(self):
+        _locals = {'self': self}
+        self.locals['character'] = _locals
+        _G_python_125, lastError = "'", None
+        _G_apply_126, lastError = self._apply(self.rule_token, "token", [_G_python_125])
+        def _G_or_127():
+            _G_apply_128, lastError = self._apply(self.rule_escapedChar, "escapedChar", [])
+            return (_G_apply_128, self.currentError)
+        def _G_or_129():
+            def _G_not_130():
+                def _G_or_131():
+                    _G_exactly_132, lastError = self.exactly("'")
+                    return (_G_exactly_132, self.currentError)
+                def _G_or_133():
+                    _G_exactly_134, lastError = self.exactly('\n')
+                    return (_G_exactly_134, self.currentError)
+                def _G_or_135():
+                    _G_exactly_136, lastError = self.exactly('\r')
+                    return (_G_exactly_136, self.currentError)
+                def _G_or_137():
+                    _G_exactly_138, lastError = self.exactly('\\')
+                    return (_G_exactly_138, self.currentError)
+                _G_or_139, lastError = self._or([_G_or_131, _G_or_133, _G_or_135, _G_or_137])
+                return (_G_or_139, self.currentError)
+            _G_not_140, lastError = self._not(_G_not_130)
+            _G_apply_141, lastError = self._apply(self.rule_anything, "anything", [])
+            return (_G_apply_141, self.currentError)
+        _G_or_142, lastError = self._or([_G_or_127, _G_or_129])
+        _locals['c'] = _G_or_142
+        _G_exactly_143, lastError = self.exactly("'")
+        _G_python_144, lastError = eval('Character(c)', self.globals, _locals), None
+        return (_G_python_144, self.currentError)
+
+
+    def rule_escapedUnicode(self):
+        _locals = {'self': self}
+        self.locals['escapedUnicode'] = _locals
+        def _G_or_145():
+            _G_exactly_146, lastError = self.exactly('u')
+            def _G_consumedby_147():
+                _G_apply_148, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_149, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_150, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_151, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                return (_G_apply_151, self.currentError)
+            _G_consumedby_152, lastError = self.consumedby(_G_consumedby_147)
+            _locals['hs'] = _G_consumedby_152
+            _G_python_153, lastError = eval('unichr(int(hs, 16))', self.globals, _locals), None
+            return (_G_python_153, self.currentError)
+        def _G_or_154():
+            _G_exactly_155, lastError = self.exactly('U')
+            def _G_consumedby_156():
+                _G_apply_157, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_158, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_159, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_160, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_161, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_162, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_163, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                _G_apply_164, lastError = self._apply(self.rule_hexdigit, "hexdigit", [])
+                return (_G_apply_164, self.currentError)
+            _G_consumedby_165, lastError = self.consumedby(_G_consumedby_156)
+            _locals['hs'] = _G_consumedby_165
+            _G_python_166, lastError = eval('unichr(int(hs, 16))', self.globals, _locals), None
+            return (_G_python_166, self.currentError)
+        _G_or_167, lastError = self._or([_G_or_145, _G_or_154])
+        return (_G_or_167, self.currentError)
+
+
+    def rule_escapedOctal(self):
+        _locals = {'self': self}
+        self.locals['escapedOctal'] = _locals
+        def _G_or_168():
+            def _G_consumedby_169():
+                _G_apply_170, lastError = self._apply(self.rule_anything, "anything", [])
+                _locals['a'] = _G_apply_170
+                def _G_pred_171():
+                    _G_python_172, lastError = eval('contains("0123", a)', self.globals, _locals), None
+                    return (_G_python_172, self.currentError)
+                _G_pred_173, lastError = self.pred(_G_pred_171)
+                def _G_optional_174():
+                    _G_apply_175, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                    return (_G_apply_175, self.currentError)
+                def _G_optional_176():
+                    return (None, self.input.nullError())
+                _G_or_177, lastError = self._or([_G_optional_174, _G_optional_176])
+                def _G_optional_178():
+                    _G_apply_179, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                    return (_G_apply_179, self.currentError)
+                def _G_optional_180():
+                    return (None, self.input.nullError())
+                _G_or_181, lastError = self._or([_G_optional_178, _G_optional_180])
+                return (_G_or_181, self.currentError)
+            _G_consumedby_182, lastError = self.consumedby(_G_consumedby_169)
+            return (_G_consumedby_182, self.currentError)
+        def _G_or_183():
+            def _G_consumedby_184():
+                _G_apply_185, lastError = self._apply(self.rule_anything, "anything", [])
+                _locals['a'] = _G_apply_185
+                def _G_pred_186():
+                    _G_python_187, lastError = eval('contains("4567", a)', self.globals, _locals), None
+                    return (_G_python_187, self.currentError)
+                _G_pred_188, lastError = self.pred(_G_pred_186)
+                def _G_optional_189():
+                    _G_apply_190, lastError = self._apply(self.rule_octdigit, "octdigit", [])
+                    return (_G_apply_190, self.currentError)
+                def _G_optional_191():
+                    return (None, self.input.nullError())
+                _G_or_192, lastError = self._or([_G_optional_189, _G_optional_191])
+                return (_G_or_192, self.currentError)
+            _G_consumedby_193, lastError = self.consumedby(_G_consumedby_184)
+            return (_G_consumedby_193, self.currentError)
+        _G_or_194, lastError = self._or([_G_or_168, _G_or_183])
+        _locals['os'] = _G_or_194
+        _G_python_195, lastError = eval('int(os, 8)', self.globals, _locals), None
+        return (_G_python_195, self.currentError)
+
+
+    def rule_escapedChar(self):
+        _locals = {'self': self}
+        self.locals['escapedChar'] = _locals
+        _G_exactly_196, lastError = self.exactly('\\')
+        def _G_or_197():
+            _G_exactly_198, lastError = self.exactly('n')
+            _G_python_199, lastError = '\n', None
+            return (_G_python_199, self.currentError)
+        def _G_or_200():
+            _G_exactly_201, lastError = self.exactly('r')
+            _G_python_202, lastError = '\r', None
+            return (_G_python_202, self.currentError)
+        def _G_or_203():
+            _G_exactly_204, lastError = self.exactly('t')
+            _G_python_205, lastError = '\t', None
+            return (_G_python_205, self.currentError)
+        def _G_or_206():
+            _G_exactly_207, lastError = self.exactly('b')
+            _G_python_208, lastError = '\b', None
+            return (_G_python_208, self.currentError)
+        def _G_or_209():
+            _G_exactly_210, lastError = self.exactly('f')
+            _G_python_211, lastError = '\f', None
+            return (_G_python_211, self.currentError)
+        def _G_or_212():
+            _G_exactly_213, lastError = self.exactly('"')
+            _G_python_214, lastError = '"', None
+            return (_G_python_214, self.currentError)
+        def _G_or_215():
+            _G_exactly_216, lastError = self.exactly("'")
+            _G_python_217, lastError = '\'', None
+            return (_G_python_217, self.currentError)
+        def _G_or_218():
+            _G_exactly_219, lastError = self.exactly('?')
+            _G_python_220, lastError = '?', None
+            return (_G_python_220, self.currentError)
+        def _G_or_221():
+            _G_exactly_222, lastError = self.exactly('\\')
+            _G_python_223, lastError = '\\', None
+            return (_G_python_223, self.currentError)
+        def _G_or_224():
+            _G_apply_225, lastError = self._apply(self.rule_escapedUnicode, "escapedUnicode", [])
+            return (_G_apply_225, self.currentError)
+        def _G_or_226():
+            _G_apply_227, lastError = self._apply(self.rule_escapedOctal, "escapedOctal", [])
+            return (_G_apply_227, self.currentError)
+        def _G_or_228():
+            _G_apply_229, lastError = self._apply(self.rule_eol, "eol", [])
+            _G_python_230, lastError = "", None
+            return (_G_python_230, self.currentError)
+        _G_or_231, lastError = self._or([_G_or_197, _G_or_200, _G_or_203, _G_or_206, _G_or_209, _G_or_212, _G_or_215, _G_or_218, _G_or_221, _G_or_224, _G_or_226, _G_or_228])
+        return (_G_or_231, self.currentError)
+
+
+    def rule_eol(self):
+        _locals = {'self': self}
+        self.locals['eol'] = _locals
+        def _G_many_232():
+            _G_apply_233, lastError = self._apply(self.rule_horizontal_space, "horizontal_space", [])
+            return (_G_apply_233, self.currentError)
+        _G_many_234, lastError = self.many(_G_many_232)
+        def _G_or_235():
+            _G_exactly_236, lastError = self.exactly('\r')
+            _G_exactly_237, lastError = self.exactly('\n')
+            return (_G_exactly_237, self.currentError)
+        def _G_or_238():
+            _G_exactly_239, lastError = self.exactly('\r')
+            return (_G_exactly_239, self.currentError)
+        def _G_or_240():
+            _G_exactly_241, lastError = self.exactly('\n')
+            return (_G_exactly_241, self.currentError)
+        _G_or_242, lastError = self._or([_G_or_235, _G_or_238, _G_or_240])
+        return (_G_or_242, self.currentError)
+
+
+    def rule_uriBody(self):
+        _locals = {'self': self}
+        self.locals['uriBody'] = _locals
+        def _G_consumedby_243():
+            def _G_many1_244():
+                def _G_or_245():
+                    _G_apply_246, lastError = self._apply(self.rule_letterOrDigit, "letterOrDigit", [])
+                    return (_G_apply_246, self.currentError)
+                def _G_or_247():
+                    _G_exactly_248, lastError = self.exactly(';')
+                    return (_G_exactly_248, self.currentError)
+                def _G_or_249():
+                    _G_exactly_250, lastError = self.exactly('/')
+                    return (_G_exactly_250, self.currentError)
+                def _G_or_251():
+                    _G_exactly_252, lastError = self.exactly('?')
+                    return (_G_exactly_252, self.currentError)
+                def _G_or_253():
+                    _G_exactly_254, lastError = self.exactly(':')
+                    return (_G_exactly_254, self.currentError)
+                def _G_or_255():
+                    _G_exactly_256, lastError = self.exactly('@')
+                    return (_G_exactly_256, self.currentError)
+                def _G_or_257():
+                    _G_exactly_258, lastError = self.exactly('&')
+                    return (_G_exactly_258, self.currentError)
+                def _G_or_259():
+                    _G_exactly_260, lastError = self.exactly('=')
+                    return (_G_exactly_260, self.currentError)
+                def _G_or_261():
+                    _G_exactly_262, lastError = self.exactly('+')
+                    return (_G_exactly_262, self.currentError)
+                def _G_or_263():
+                    _G_exactly_264, lastError = self.exactly('$')
+                    return (_G_exactly_264, self.currentError)
+                def _G_or_265():
+                    _G_exactly_266, lastError = self.exactly(',')
+                    return (_G_exactly_266, self.currentError)
+                def _G_or_267():
+                    _G_exactly_268, lastError = self.exactly('-')
+                    return (_G_exactly_268, self.currentError)
+                def _G_or_269():
+                    _G_exactly_270, lastError = self.exactly('.')
+                    return (_G_exactly_270, self.currentError)
+                def _G_or_271():
+                    _G_exactly_272, lastError = self.exactly('!')
+                    return (_G_exactly_272, self.currentError)
+                def _G_or_273():
+                    _G_exactly_274, lastError = self.exactly('~')
+                    return (_G_exactly_274, self.currentError)
+                def _G_or_275():
+                    _G_exactly_276, lastError = self.exactly('*')
+                    return (_G_exactly_276, self.currentError)
+                def _G_or_277():
+                    _G_exactly_278, lastError = self.exactly("'")
+                    return (_G_exactly_278, self.currentError)
+                def _G_or_279():
+                    _G_exactly_280, lastError = self.exactly('(')
+                    return (_G_exactly_280, self.currentError)
+                def _G_or_281():
+                    _G_exactly_282, lastError = self.exactly(')')
+                    return (_G_exactly_282, self.currentError)
+                def _G_or_283():
+                    _G_exactly_284, lastError = self.exactly('%')
+                    return (_G_exactly_284, self.currentError)
+                def _G_or_285():
+                    _G_exactly_286, lastError = self.exactly('\\')
+                    return (_G_exactly_286, self.currentError)
+                def _G_or_287():
+                    _G_exactly_288, lastError = self.exactly('|')
+                    return (_G_exactly_288, self.currentError)
+                def _G_or_289():
+                    _G_exactly_290, lastError = self.exactly('#')
+                    return (_G_exactly_290, self.currentError)
+                _G_or_291, lastError = self._or([_G_or_245, _G_or_247, _G_or_249, _G_or_251, _G_or_253, _G_or_255, _G_or_257, _G_or_259, _G_or_261, _G_or_263, _G_or_265, _G_or_267, _G_or_269, _G_or_271, _G_or_273, _G_or_275, _G_or_277, _G_or_279, _G_or_281, _G_or_283, _G_or_285, _G_or_287, _G_or_289])
+                return (_G_or_291, self.currentError)
+            _G_many1_292, lastError = self.many(_G_many1_244, _G_many1_244())
+            return (_G_many1_292, self.currentError)
+        _G_consumedby_293, lastError = self.consumedby(_G_consumedby_243)
+        return (_G_consumedby_293, self.currentError)
diff --git a/lib/monte/monte/eparser.py b/lib/monte/monte/eparser.py
new file mode 100644
--- /dev/null
+++ b/lib/monte/monte/eparser.py
@@ -0,0 +1,391 @@
+# Copyright (c) Twisted Matrix Laboratories.
+# See LICENSE for details.
+
+from ometa.runtime import ParseError
+
+#from monte.grammar import MonteOMeta
+from monte.common import CommonParser
+from monte.eparser_generated_fast import BaseEParser
+from monte.terml_nodes import termMaker as t
+
+egrammar = r"""
+updocLine = <('?'|'#'|'>') (~('\n' | '\r') anything)*>:txt eol -> txt
+updoc = ('?' (~('\n' | '\r') anything)*
+             ((eol (eol | updocLine)*) (spaces | updocLine))?
+        )
+
+eolplus = eol updoc?
+linesep = eolplus+
+
+br = (spaces eolplus | eolplus)*
+
+literal = (string | character | number):x -> t.LiteralExpr(x)
+identifier = spaces <(letter | '_') (letterOrDigit | '_')*>
+uri = "<" uriScheme:s ':' uriBody:b '>' -> t.URIExpr(s, b)
+uriGetter = "<" uriScheme:s '>' -> t.URIGetter(s)
+uriScheme = <letter (letterOrDigit | '_' | '+' | '-' | '.')*>
+
+noun = sourceHole | justNoun
+justNoun = ((identifier:id -> self.keywordCheck(id)
+              | ("::" (string | identifier):x -> x)):n  -> t.NounExpr(n)
+              | uriGetter)
+sourceHole = ("$" (-> self.valueHole()):v '{' digit+:ds '}' -> t.QuasiLiteralExpr(v)
+               |"@" (-> self.patternHole()):v '{' digit+:ds '}' -> t.QuasiPatternExpr(v))
+
+quasiString = "`" (exprHole | pattHole | quasiText)*:qs '`' -> qs
+
+quasiText = <(~('`'|'$'|'@') anything | '`' '`' | '$' '$' | ('$' | '@') '\\' escapedChar | '@' '@')+>:qs -> t.QuasiText(qs.replace("``", "`"))
+
+exprHole = '$' ('{' br seq:s '}' -> t.QuasiExprHole(s)
+                 |'_' !(noIgnoreExpressionHole())
+                 |identifier:n !(exprHoleKeywordCheck(n)) -> t.QuasiExprHole(t.NounExpr(n)))
+pattHole = '@' ('{' br pattern:s '}' -> t.QuasiPatternHole(s)
+                 |'_' !(noIgnorePatternHole())
+                 |identifier:n !(quasiHoleKeywordCheck(n)) -> t.QuasiPatternHole(t.FinalPattern(t.NounExpr(n), None)))
+
+reifyExpr = ("&&" verb:v -> t.BindingExpr(v)
+            |"&" verb:v -> t.SlotExpr(v))
+
+verb = identifier | string
+
+listAndMap = "[" (assoc:x ("," assoc)*:xs ","? ']' -> t.MapExpr([x] + xs)
+                   |(seq:s ("," seq)*:ss ","? ']')-> t.ListExpr([s] + ss)
+                   | ']' -> t.ListExpr([]))
+assoc = (seq:k "=>" seq:v -> t.MapExprAssoc(k, v)
+          |"=>" (noun | reifyExpr):n -> t.MapExprExport(n)
+                | "def" noun:n ~":=" !(throwSemanticHere("Reserved syntax: forward export")))
+
+
+prim = ( literal
+         | basic
+         | identifier?:n quasiString:qs -> t.QuasiExpr(n, qs)
+         | noun
+         | uri
+         | parenExpr:p (quasiString:qs -> t.QuasiExpr(p, qs)
+                         | -> p)
+         | block:b -> t.HideExpr(b)
+         | listAndMap
+         )
+
+parenExpr = "(" seq:s token(')') -> s
+block = "{" (seq |-> t.SeqExpr([])):s token('}') -> s
+
+seqSep = (";"| linesep)+
+seq = expr:e ((seqSep expr)+:es seqSep? -> t.SeqExpr(filter(None, [e] + es))
+                 |seqSep? -> e)
+parenArgs = "(" args:a token(')') -> a
+args = (seq:s ("," seq)*:ss -> [s] + ss
+         |-> [])
+
+call = (call:c ("." verb:v (parenArgs:x -> t.MethodCallExpr(c, v, x)
+                                  | -> t.VerbCurryExpr(c, v))
+                    |"[" args:a token(']') -> t.GetExpr(c, a)
+                    |parenArgs:x -> t.FunctionCallExpr(c, x)
+                    | "<-" (parenArgs:x -> t.FunctionSendExpr(c, x)
+                           |verb:v (parenArgs:x -> t.MethodSendExpr(c, v, x)
+                                     | -> t.SendCurryExpr(c, v)))
+                    )
+         |prim
+         )
+
+prefix = (call
+           | "-" call:c -> t.Minus(c)
+           | "!" call:c -> t.LogicalNot(c)
+           | "~" call:c -> t.BinaryNot(c)
+           | reifyExpr
+           | "&" call !(throwSemanticHere("reserved: unary prefix '&' applied to non-noun lValue")))
+
+pow = prefix:x ("**" prefix:y -> t.Pow(x, y)
+                   | -> x)
+mult = (mult:x ("*" pow:y -> t.Multiply(x, y)
+                 |"/" pow:y -> t.Divide(x, y)
+                 |"//" pow:y -> t.FloorDivide(x, y)
+                 |"%" pow:y -> t.Remainder(x, y)
+                 |"%%" pow:y -> t.Mod(x, y))
+         |pow)
+
+add = (add:x ("+" mult:y -> t.Add(x, y)
+                 |"-" mult:y -> t.Subtract(x, y))
+        | mult)
+
+shift = (shift:x ("<<" add:y -> t.ShiftLeft(x, y)
+                     |">>" add:y -> t.ShiftRight(x, y))
+          |add)
+
+interval = shift:x ("..!" shift:y -> t.Till(x, y)
+                       |".." shift:y -> t.Thru(x, y)
+                       | -> x)
+
+order = interval:x (">" interval:y -> t.GreaterThan(x, y)
+                       | ">=" interval:y -> t.GreaterThanEqual(x, y)
+                       | "<=>" interval:y -> t.AsBigAs(x, y)
+                       | "<=" interval:y -> t.LessThanEqual(x, y)
+                       | "<" interval:y -> t.LessThan(x, y)
+                       | ":" guard:g -> t.Coerce(x, g)
+                       | -> x)
+
+logical = (band
+            |bor
+            |(order:x ("=~" pattern:p -> t.MatchBind(x, p)
+                        |"!~" pattern:p -> t.Mismatch(x, p)
+                        |"==" order:y -> t.Same(x, y)
+                        |"!=" order:y -> t.NotSame(x, y)
+                        |"&!" order:y -> t.ButNot(x, y)
+                        |"^" order:y -> t.BinaryXor(x, y)
+                        | -> x)))
+
+band = (band:x ~("&&" | "&!") "&" order:y -> t.BinaryAnd(x, y)
+         |order:x ~("&&" | "&!") "&" order:y -> t.BinaryAnd(x, y))
+
+bor = (bor:x "|" order:y -> t.BinaryOr(x, y)
+        |order:x "|" order:y -> t.BinaryOr(x, y))
+
+condAnd = logical:x (("&&" condAnd):y -> t.LogicalAnd(x, y)
+                        | -> x)
+cond = condAnd:x (("||" cond):y -> t.LogicalOr(x, y)
+                     | -> x)
+assign = (~objectExpr "def" (pattern:p ("exit" order)?:e ":=" assign:a -> t.Def(p, e, a)
+                  |noun:n (~~seqSep | end)-> t.Forward(n))
+           |keywordPattern:p ":=" assign:a -> t.Def(p, None, a)
+           |cond:x (":=" assign:y -> t.Assign(x, y)
+                    |assignOp:o assign:y -> t.AugAssign(o, x, y)
+                    |identifier:v '=' (parenArgs:y -> t.VerbAssign(v, x, y)
+                                        |assign:y -> t.VerbAssign(v, x, [y]))
+                    | -> x))
+
+assignOp = ("+=" -> "Add"
+             |"-=" -> "Subtract"
+             |"*=" -> "Multiply"
+             |"/=" -> "Divide"
+             |"%=" -> "Remainder"
+             |"%%=" -> "Mod"
+             |"**=" -> "Pow"
+             |"//=" -> "FloorDivide"
+             |">>=" -> "ShiftRight"
+             |"<<=" -> "ShiftLeft"
+             |"&=" -> "BinaryAnd"
+             |"|=" -> "BinaryOr"
+             |"^=" -> "BinaryXor")
+
+expr =  assign | ejector
+ejector = ((token("break") (-> t.Break) | token("continue") (-> t.Continue) | token("return") (-> t.Return)):ej
+             (("(" token(")") -> None) | assign)?:val -> ej(val))
+
+guard = (noun | parenExpr):e ("[" args:x token(']') -> x)*:xs -> t.Guard(e, xs)
+optGuard = (":" guard)?
+eqPattern = (token('_') ~letterOrDigit optGuard:e -> t.IgnorePattern(e)
+              |identifier?:n quasiString:q -> t.QuasiPattern(n, q)
+              |namePattern
+              |"==" prim:p -> t.SamePattern(p)
+              |"!=" prim:p -> throwSemanticHere("reserved: not-same pattern")
+              )
+
+patterns = (pattern:p ("," pattern)*:ps -> [p] + ps
+             | -> [])
+key = (parenExpr | literal):x br -> x
+
+keywordPattern = (token("var") noun:n optGuard:g -> t.VarPattern(n, g)
+                   |token("bind") noun:n optGuard:g -> t.BindPattern(n, g))
+namePattern = (keywordPattern
+              |noun:n optGuard:g -> t.FinalPattern(n, g)
+              |reifyPattern)
+
+reifyPattern = ("&&" noun:n optGuard:g -> t.BindingPattern(n, g)
+               |"&" noun:n optGuard:g -> t.SlotPattern(n, g))
+
+mapPatternAddressing = (key:k "=>" pattern:v -> t.MapPatternAssoc(k, v)
+                         |"=>" namePattern:p -> t.MapPatternImport(p))
+
+mapPattern = mapPatternAddressing:a (":=" order:d -> t.MapPatternOptional(a, d)
+                                        | -> t.MapPatternRequired(a))
+mapPatts = mapPattern:m ("," mapPattern)*:ms -> [m] + ms
+
+listPatternInner = (mapPatts:ms br token(']') ("|" listPattern)?:tail -> t.MapPattern(ms, tail)
+                     |patterns:ps br token(']') ("+" listPattern)?:tail -> t.ListPattern(ps, tail))
+listPattern = (
+                "via" parenExpr:e listPattern:p -> t.ViaPattern(e, p)
+                | eqPattern
+                | "[" listPatternInner)
+pattern = listPattern:p ("?" order:e -> t.SuchThatPattern(p, e)
+                            | -> p)
+
+basic = docoDef | accumExpr | escapeExpr | forExpr | ifExpr | lambdaExpr | metaExpr | switchExpr | tryExpr | whileExpr | whenExpr
+
+docoDef = doco?:doc (objectExpr:o -> t.Object(doc, *o)
+                       |interfaceExpr:i -> t.Interface(doc, *i))
+doco = token("/**") <(~('*' '/') anything)*>:doc '*' '/' -> doc.strip()
+objectExpr = ((token("def") objectName:n) | keywordPattern:n) objectTail:tail -> [n, tail]
+objectName = (token('_') optGuard:e -> t.IgnorePattern(e)
+               |namePattern)
+objectTail = (functionTail
+               |((token("extends") br order)?:e oAs?:g oImplements:oi scriptPair:s
+                  -> t.Script(e, g, oi, *s)))
+oAs = token("as") br order
+oImplements = (token("implements") br order:x ("," order)*:xs -> [x] + xs
+               | -> [])
+functionTail = parenParamList:ps optResultGuard:g oImplements:fi block:b -> t.Function(ps, g, fi, b)
+parenParamList = "(" (pattern:p ("," pattern)*:ps token(")") -> [p] +  ps
+                       | token(")") -> [])
+optResultGuard = (":" guard)?
+scriptPair = "{" method*:methods matcher*:matchers token("}") -> [methods, matchers]
+method = (doco?:doc ((token("to") -> t.To) | token("method") -> t.Method):to verb?:v parenParamList:ps optResultGuard:g block:b -> to(doc, v, ps, g, b))
+matcher = token("match") pattern:p block:b -> t.Matcher(p, b)
+
+interfaceExpr = (token("interface") objectName:n iguards?:g ((multiExtends:es oImplements:oi iscript:s -> [n, g, es, oi, s])
+                       |parenParamDescList:ps optGuard:rg -> [n, g, [], [], t.InterfaceFunction(ps, rg)]))
+iguards = token("guards") pattern
+multiExtends = ((token("extends") br order:x ("," order)*:xs -> [x] + xs)
+                 | -> [])
+iscript = "{" (messageDesc:m br -> m)*:ms token("}") -> ms
+messageDesc = (doco?:doc (token("to") | token("method")):to verb?:v parenParamDescList:ps optGuard:g
+                -> t.MessageDesc(doc, to, v, ps, g))
+paramDesc = (justNoun | token('_') -> None):n optGuard:g -> t.ParamDesc(n, g)
+parenParamDescList = "(" paramDesc:p ("," paramDesc)*:ps token(")") -> [p] +  ps
+
+accumExpr = token("accum") call:c accumulator:a -> t.Accum(c, a)
+accumulator = (((token("for") forPattern:p token("in") logical:a accumBody:b catcher?:c -> t.AccumFor(*(p + [a, b, c]))))
+                |(token("if") parenExpr:e accumBody:a -> t.AccumIf(e, a))
+                |(token("while") parenExpr:e accumBody:a catcher?:c -> t.AccumWhile(e, a, c)))
+
+accumBody = "{" (token('_') (accumOp:op assign:a -> t.AccumOp(op, a)
+                               |"." verb:v parenArgs:ps -> t.AccumCall(v, ps))
+                  | accumulator):ab br token("}") -> ab
+accumOp = ("+" -> "Add"
+            |"*" -> "Multiply"
+            |"&" -> "BinaryAnd"
+            |"|" -> "BinaryOr")
+
+escapeExpr = token("escape") pattern:p block:b catcher?:c -> t.Escape(p, b, c)
+
+forExpr = token("for") forPattern:p token("in") br assign:a block:b catcher?:c -> t.For(*(p + [a, b, c]))
+
+forPattern = pattern:p (br "=>" pattern:px -> [p, px]
+                           | -> [None, p])
+
+ifExpr = token("if") parenExpr:p br block:b (token("else") (ifExpr | block) | -> None):e -> t.If(p, b, e)
+
+lambdaExpr = doco?:doc token("fn") patterns:ps block:b -> t.Lambda(doc, ps, b)
+
+metaExpr = token("meta") "." (token("getState") -> "State"
+                                |token("scope") -> "Scope"
+                                |token("context") -> "Context"):s "(" token(")") -> t.Meta(s)
+switchExpr = token("switch") parenExpr:e "{" (matcher:m br -> m)*:ms token("}") -> t.Switch(e, ms)
+
+tryExpr = token("try") block:tb catcher*:cs (token("finally") block)?:fb -> t.Try(tb, cs, fb)
+catcher = token("catch") pattern:p block:b -> t.Catch(p, b)
+
+whileExpr = token("while") parenExpr:e block:b catcher?:c -> t.While(e, b, c)
+
+whenExpr = token("when") parenArgs:a br "->" block:b catcher*:cs (token("finally") block)?:fb -> t.When(a, b, cs, fb)
+
+topSeq = topExpr:x (seqSep topExpr)*:xs seqSep? -> t.SeqExpr([x] + xs)
+pragma = token("pragma") "." verb:v "(" string:s token(")") -> t.Pragma(v, s)
+topExpr = (pragma -> t.NounExpr("null")) | expr
+start = updoc? br topSeq?
+"""
+
+
+reserved = set(["delegate", "module", "abstract", "an", "as", "assert", "attribute",
+           "be", "begin", "behalf", "belief", "believe", "believes", "case",
+           "class", "const", "constructor", "declare", "default", "define",
+           "defmacro", "delicate", "deprecated", "dispatch", "do", "encapsulate",
+           "encapsulated", "encapsulates", "end", "ensure", "enum", "eventual",
+           "eventually", "export", "facet", "forall", "function", "given",
+           "hidden", "hides", "inline", "is", "know", "knows", "lambda", "let",
+           "methods", "namespace", "native", "obeys", "octet", "oneway",
+           "operator", "package", "private", "protected", "public",
+           "raises", "reliance", "reliant", "relies", "rely", "reveal", "sake",
+           "signed", "static", "struct", "suchthat", "supports", "suspect",
+           "suspects", "synchronized", "this", "transient", "truncatable",
+           "typedef", "unsigned", "unum", "uses", "using", "utf8", "utf16",
+           "virtual", "volatile", "wstring"])
+basicKeywords = set(["bind", "break", "catch", "continue", "def", "else", "escape", "exit",
+           "extends", "finally", "fn", "for", "guards", "if", "implements", "in",
+           "interface", "match", "meta", "method", "pragma", "return", "switch",
+           "to", "try", "var", "via", "when", "while", "accum", "module", "on",
+           "select", "throws", "thunk"])
+
+keywords = reserved | basicKeywords
+def quasiHoleKeywordCheck(n):
+    if n in keywords:
+        raise ValueError("Unexpected keyword %r in quasi hole" % (n,))
+    else:
+        return None
+
+def exprHoleKeywordCheck(n):
+    if n in keywords:
+        raise ValueError("Unexpected keyword %r in quasi hole" % (n,))
+    else:
+        return None
+
+def throwSemanticHere(arg):
+    """
+    Raise an error when invalid source is parsed.
+    """
+    raise ValueError(arg)
+
+def noIgnorePatternHole():
+    raise RuntimeError()
+
+def noIgnoreExpressionHole():
+    raise RuntimeError()
+
+
+#BaseEParser = MonteOMeta.makeGrammar(egrammar,  {}, "BaseEParser")
+
+class EParser(CommonParser, BaseEParser):
+    """
+    A parser for E.
+    """
+
+    def rule_tokenBR(self):
+        """
+        Match and return the given string, consuming any preceding or trailing
+        whitespace.
+        """
+        tok, _ = self.input.head()
+
+        m = self.input = self.input.tail()
+        try:
+            self.eatWhitespace()
+            for c  in tok:
+                self.exactly(c)
+            _, e = self.apply("br")
+            return tok, e
+        except ParseError:
+            self.input = m
+            raise
+
+
+    def keywordCheck(self, ident):
+        """
+        Ensure an identifier isn't a keyword or reserved word.
+        """
+        if ident in reserved:
+            raise ParseError(self.input, self.input.position, ident + " is a reserved word")
+        elif ident in basicKeywords:
+            raise ParseError(self.input, self.input.position, ident + " is a keyword")
+        else:
+            return ident
+
+    def valueHole(self):
+        """
+        Look up a value hole in the table and return its position.
+        """
+        try:
+            return self.valueHoles.index(self.input.position - 1)
+        except ValueError:
+            raise ValueError("A literal $ is not meaningful in E source.")
+
+    def patternHole(self):
+        """
+        Look up a pattern hole in the table and return its position.
+        """
+        try:
+            return self.patternHoles.index(self.input.position - 1)
+        except ValueError:
+            raise ValueError("A literal @ is not meaningful in E source.")
+
+EParser.globals = {}
+EParser.globals.update(globals())
+EParser.globals.update(CommonParser.globals)
diff --git a/lib/monte/monte/eparser_generated.py b/lib/monte/monte/eparser_generated.py
new file mode 100644
--- /dev/null
+++ b/lib/monte/monte/eparser_generated.py
@@ -0,0 +1,3846 @@
+from ometa.runtime import OMetaGrammarBase as GrammarBase
+class BaseEParser(GrammarBase):
+    def rule_updocLine(self):
+        _locals = {'self': self}
+        self.locals['updocLine'] = _locals
+        def _G_consumedby_1():
+            def _G_or_2():
+                _G_exactly_3, lastError = self.exactly('?')
+                self.considerError(lastError, None)
+                return (_G_exactly_3, self.currentError)
+            def _G_or_4():
+                _G_exactly_5, lastError = self.exactly('#')
+                self.considerError(lastError, None)
+                return (_G_exactly_5, self.currentError)
+            def _G_or_6():
+                _G_exactly_7, lastError = self.exactly('>')
+                self.considerError(lastError, None)
+                return (_G_exactly_7, self.currentError)
+            _G_or_8, lastError = self._or([_G_or_2, _G_or_4, _G_or_6])
+            self.considerError(lastError, None)
+            def _G_many_9():
+                def _G_not_10():
+                    def _G_or_11():
+                        _G_exactly_12, lastError = self.exactly('\n')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_12, self.currentError)
+                    def _G_or_13():
+                        _G_exactly_14, lastError = self.exactly('\r')
+                        self.considerError(lastError, None)
+                        return (_G_exactly_14, self.currentError)
+                    _G_or_15, lastError = self._or([_G_or_11, _G_or_13])
+                    self.considerError(lastError, None)
+                    return (_G_or_15, self.currentError)
+                _G_not_16, lastError = self._not(_G_not_10)
+                self.considerError(lastError, None)
+                _G_apply_17, lastError = self._apply(self.rule_anything, "anything", [])
+                self.considerError(lastError, None)
+                return (_G_apply_17, self.currentError)
+            _G_many_18, lastError = self.many(_G_many_9)
+            self.considerError(lastError, None)
+            return (_G_many_18, self.currentError)
+        _G_consumedby_19, lastError = self.consumedby(_G_consumedby_1)
+        self.considerError(lastError, 'updocLine')
+        _locals['txt'] = _G_consumedby_19
+        _G_apply_20, lastError = self._apply(self.rule_eol, "eol", [])
+        self.considerError(lastError, 'updocLine')
+        _G_python_21, lastError = eval('txt', self.globals, _locals), None
+        self.considerError(lastError, 'updocLine')
+        return (_G_python_21, self.currentError)
+
+
+    def rule_updoc(self):
+        _locals = {'self': self}
+        self.locals['updoc'] = _locals
+        _G_exactly_22, lastError = self.exactly('?')
+        self.considerError(lastError, 'updoc')
+        def _G_many_23():
+            def _G_not_24():
+                def _G_or_25():
+                    _G_exactly_26, lastError = self.exactly('\n')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_26, self.currentError)
+                def _G_or_27():
+                    _G_exactly_28, lastError = self.exactly('\r')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_28, self.currentError)
+                _G_or_29, lastError = self._or([_G_or_25, _G_or_27])
+                self.considerError(lastError, None)
+                return (_G_or_29, self.currentError)
+            _G_not_30, lastError = self._not(_G_not_24)
+            self.considerError(lastError, None)
+            _G_apply_31, lastError = self._apply(self.rule_anything, "anything", [])
+            self.considerError(lastError, None)
+            return (_G_apply_31, self.currentError)
+        _G_many_32, lastError = self.many(_G_many_23)
+        self.considerError(lastError, 'updoc')
+        def _G_optional_33():
+            _G_apply_34, lastError = self._apply(self.rule_eol, "eol", [])
+            self.considerError(lastError, None)
+            def _G_many_35():
+                def _G_or_36():
+                    _G_apply_37, lastError = self._apply(self.rule_eol, "eol", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_37, self.currentError)
+                def _G_or_38():
+                    _G_apply_39, lastError = self._apply(self.rule_updocLine, "updocLine", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_39, self.currentError)
+                _G_or_40, lastError = self._or([_G_or_36, _G_or_38])
+                self.considerError(lastError, None)
+                return (_G_or_40, self.currentError)
+            _G_many_41, lastError = self.many(_G_many_35)
+            self.considerError(lastError, None)
+            def _G_or_42():
+                _G_apply_43, lastError = self._apply(self.rule_spaces, "spaces", [])
+                self.considerError(lastError, None)
+                return (_G_apply_43, self.currentError)
+            def _G_or_44():
+                _G_apply_45, lastError = self._apply(self.rule_updocLine, "updocLine", [])
+                self.considerError(lastError, None)
+                return (_G_apply_45, self.currentError)
+            _G_or_46, lastError = self._or([_G_or_42, _G_or_44])
+            self.considerError(lastError, None)
+            return (_G_or_46, self.currentError)
+        def _G_optional_47():
+            return (None, self.input.nullError())
+        _G_or_48, lastError = self._or([_G_optional_33, _G_optional_47])
+        self.considerError(lastError, 'updoc')
+        return (_G_or_48, self.currentError)
+
+
+    def rule_eolplus(self):
+        _locals = {'self': self}
+        self.locals['eolplus'] = _locals
+        _G_apply_49, lastError = self._apply(self.rule_eol, "eol", [])
+        self.considerError(lastError, 'eolplus')
+        def _G_optional_50():
+            _G_apply_51, lastError = self._apply(self.rule_updoc, "updoc", [])
+            self.considerError(lastError, None)
+            return (_G_apply_51, self.currentError)
+        def _G_optional_52():
+            return (None, self.input.nullError())
+        _G_or_53, lastError = self._or([_G_optional_50, _G_optional_52])
+        self.considerError(lastError, 'eolplus')
+        return (_G_or_53, self.currentError)
+
+
+    def rule_linesep(self):
+        _locals = {'self': self}
+        self.locals['linesep'] = _locals
+        def _G_many1_54():
+            _G_apply_55, lastError = self._apply(self.rule_eolplus, "eolplus", [])
+            self.considerError(lastError, None)
+            return (_G_apply_55, self.currentError)
+        _G_many1_56, lastError = self.many(_G_many1_54, _G_many1_54())
+        self.considerError(lastError, 'linesep')
+        return (_G_many1_56, self.currentError)
+
+
+    def rule_br(self):
+        _locals = {'self': self}
+        self.locals['br'] = _locals
+        def _G_many_57():
+            def _G_or_58():
+                _G_apply_59, lastError = self._apply(self.rule_spaces, "spaces", [])
+                self.considerError(lastError, None)
+                _G_apply_60, lastError = self._apply(self.rule_eolplus, "eolplus", [])
+                self.considerError(lastError, None)
+                return (_G_apply_60, self.currentError)
+            def _G_or_61():
+                _G_apply_62, lastError = self._apply(self.rule_eolplus, "eolplus", [])
+                self.considerError(lastError, None)
+                return (_G_apply_62, self.currentError)
+            _G_or_63, lastError = self._or([_G_or_58, _G_or_61])
+            self.considerError(lastError, None)
+            return (_G_or_63, self.currentError)
+        _G_many_64, lastError = self.many(_G_many_57)
+        self.considerError(lastError, 'br')
+        return (_G_many_64, self.currentError)
+
+
+    def rule_literal(self):
+        _locals = {'self': self}
+        self.locals['literal'] = _locals
+        def _G_or_65():
+            _G_apply_66, lastError = self._apply(self.rule_string, "string", [])
+            self.considerError(lastError, None)
+            return (_G_apply_66, self.currentError)
+        def _G_or_67():
+            _G_apply_68, lastError = self._apply(self.rule_character, "character", [])
+            self.considerError(lastError, None)
+            return (_G_apply_68, self.currentError)
+        def _G_or_69():
+            _G_apply_70, lastError = self._apply(self.rule_number, "number", [])
+            self.considerError(lastError, None)
+            return (_G_apply_70, self.currentError)
+        _G_or_71, lastError = self._or([_G_or_65, _G_or_67, _G_or_69])
+        self.considerError(lastError, 'literal')
+        _locals['x'] = _G_or_71
+        _G_python_72, lastError = eval('t.LiteralExpr(x)', self.globals, _locals), None
+        self.considerError(lastError, 'literal')
+        return (_G_python_72, self.currentError)
+
+
+    def rule_identifier(self):
+        _locals = {'self': self}
+        self.locals['identifier'] = _locals
+        _G_apply_73, lastError = self._apply(self.rule_spaces, "spaces", [])
+        self.considerError(lastError, 'identifier')
+        def _G_consumedby_74():
+            def _G_or_75():
+                _G_apply_76, lastError = self._apply(self.rule_letter, "letter", [])
+                self.considerError(lastError, None)
+                return (_G_apply_76, self.currentError)
+            def _G_or_77():
+                _G_exactly_78, lastError = self.exactly('_')
+                self.considerError(lastError, None)
+                return (_G_exactly_78, self.currentError)
+            _G_or_79, lastError = self._or([_G_or_75, _G_or_77])
+            self.considerError(lastError, None)
+            def _G_many_80():
+                def _G_or_81():
+                    _G_apply_82, lastError = self._apply(self.rule_letterOrDigit, "letterOrDigit", [])
+                    self.considerError(lastError, None)
+                    return (_G_apply_82, self.currentError)
+                def _G_or_83():
+                    _G_exactly_84, lastError = self.exactly('_')
+                    self.considerError(lastError, None)
+                    return (_G_exactly_84, self.currentError)
+                _G_or_85, lastError = self._or([_G_or_81, _G_or_83])
+                self.considerError(lastError, None)
+                return (_G_or_85, self.currentError)
+            _G_many_86, lastError = self.many(_G_many_80)
+            self.considerError(lastError, None)
+            return (_G_many_86, self.currentError)
+        _G_consumedby_87, lastError = self.consumedby(_G_consumedby_74)
+        self.considerError(lastError, 'identifier')
+        return (_G_consumedby_87, self.currentError)
+
+
+    def rule_uri(self):
+        _locals = {'self': self}
+        self.locals['uri'] = _locals
+        _G_python_88, lastError = '<', None
+        self.considerError(lastError, 'uri')
+        _G_apply_89, lastError = self._apply(self.rule_tokenBR, "tokenBR", [_G_python_88])
+        self.considerError(lastError, 'uri')
+        _G_apply_90, lastError = self._apply(self.rule_uriScheme, "uriScheme", [])
+        self.considerError(lastError, 'uri')
+        _locals['s'] = _G_apply_90
+        _G_exactly_91, lastError = self.exactly(':')
+        self.considerError(lastError, 'uri')
+        _G_apply_92, lastError = self._apply(self.rule_uriBody, "uriBody", [])
+        self.considerError(lastError, 'uri')
+        _locals['b'] = _G_apply_92
+        _G_exactly_93, lastError = self.exactly('>')
+        self.considerError(lastError, 'uri')
+        _G_python_94, lastError = eval('t.URIExpr(s, b)', self.globals, _locals), None
+        self.considerError(lastError, 'uri')
+        return (_G_python_94, self.currentError)
+
+
+    def rule_uriGetter(self):
+        _locals = {'self': self}
+        self.locals['uriGetter'] = _locals
+        _G_python_95, lastError = '<', None


More information about the pypy-commit mailing list