Skip to content

Instantly share code, notes, and snippets.

View HiZhaoxiaoyang's full-sized avatar

Zhaoxiaoyang HiZhaoxiaoyang

View GitHub Profile
@HiZhaoxiaoyang
HiZhaoxiaoyang / parser.js
Last active August 29, 2015 14:14 — forked from chunpu/parser.js
var tokenRules = [
['number', /^\d+/],
['space', /^ +/],
'+', '-', '*', '/'
]
var str = '1 + 2 * 3 + 33 / 3'
function lex(str, tokenRules) {
var tokens = []