diff python/ppci/frontends/ks/parser.py @ 101:af0d7913677a

Fixes and splitting into 3 stage
author windel
date Mon, 24 Dec 2012 17:55:08 +0100
parents fe145e42259d
children 63937c8d1478
line wrap: on
line diff
--- a/python/ppci/frontends/ks/parser.py	Mon Dec 24 16:35:22 2012 +0100
+++ b/python/ppci/frontends/ks/parser.py	Mon Dec 24 17:55:08 2012 +0100
@@ -5,15 +5,14 @@
 from .symboltable import SymbolTable
 from .nodes import *
 from ...core.errors import CompilerException, Error
-#from .modules import loadModule
-#from .display import printNode
 #from .builtin import *
 #from . import assembler
+from .lexer import tokenize
 
 class KsParser:
-   def __init__(self, tokens):
+   def __init__(self, source):
       """ provide the parser with the tokens iterator from the lexer. """
-      self.tokens = tokens
+      self.tokens = tokenize(source) # Lexical stage
       self.NextToken()
       self.errorlist = []
 
@@ -53,6 +52,7 @@
         Starting symbol is the Module.
    """
    def parseModule(self):
+       """ Top level parsing routine """
        self.imports = []
        loc = self.getLocation()
        self.Consume('module')
@@ -98,7 +98,7 @@
    def parseImport(self):
       loc = self.getLocation()
       modname = self.Consume('ID')
-      mod = loadModule(modname)
+      #mod = loadModule(modname)
       self.setLocation(mod, loc)
       self.cst.addSymbol(mod)