ometa TestParser { obj = :o ?(o.type !== undefined) -> o, token :tt = obj:o ?(o.type == tt) -> o | :t ?(t[0] == tt) -> t, foo = ``person'' ``something'', topLevel = anything+:o ?(o instanceof Array) -> o } Obj = function(second){ this[0] = 'person'; this[1] = second; this.length = 1; this.type = "Object"; } Obj.prototype = Array.prototype; var tree = new Obj('something'); matched = TestParser.matchAll(tree, 'topLevel'); console.log(matched);