local Column = {} --Assume methods
local State = {}
local Production = {}
function predict()
    --Given term, find all terms with
    --Same name, insert into current
    --Column
end
function scan()
    --If next symbol is non terminal
    --Advance current state and
    --Insert into next Column
    --Insert tokens that are expecting the current token, next
end
function complete()
    --Given completed term, find
    --all terms previously indexing
    --that term, add advanced term to current
    --Column
end
while true do
    local token = self.lexer.next
    local Column = Column.new(...)
    for state in Column do
        if state.complete then
           complete(state)
        else
            if state.symbols[state.dot] == n then
                predictor(state)
            else
                scan(state)
            end
        end
    end 
end

Vocab:

Non terminal → Terms/ Defined Production rules: (Production) → Symbols

Terminal → Literals, RegExps, Tokens: Production → [(Token), (Literal), Non terminal, (Regexp)]

Column → Group of states

State → Current state of a production

Production → Defined non-terminal/rule

Resources

Pseudo code

Pseudo code

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/05771257-dbe8-4065-88da-96ad5a5e1dd8/07F20BA6-CC14-4DA6-94CC-5518E3E41364.jpeg