¡@

Home 

javascript Programming Glossary: peeknexttoken

Generate syntax tree for simple math operations

http://stackoverflow.com/questions/2705727/generate-syntax-tree-for-simple-math-operations

Basically you need a tokenizer that provides getNextToken peekNextToken and skipNextToken. Then you work your way down using this structure... else ret nextToken currToken undefined return ret function peekNextToken if currToken currToken nextToken return currToken function skipNextToken.. var left multiplicativeExpression var tok peekNextToken while tok.type TOK_OPERATOR tok.op ' ' tok.op ' ' skipNextToken..