Title / Description
Code def parse(element,text): tokens = text.split() tokens.reverse() return rec_parse(element,tokens) def rec_parse(element,tokens): for path in grammar[element]: elements = [element] item = None valid = True for word in path: if tokens[-1] == word: item = tokens.pop() elif word in grammar: item = rec_parse(word,tokens) if item != None:ss elements.append(item) else: valid = False break if valid: return elements return None def parse_s(text): return parse('S', text)
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code