Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Sunday, July 4, 2010

Simple Mathematical Expression Converter with Jay

I wrote a simple mathematical expression converter with Jay: Yacc for Java for my study.

The sample code in this page is a mathematical expression interpreter. You can calculate four arithmetic operations and more like 1 + 2 * 3 to 7. My code which will be described in this post converts expressions into reverse Polish notation ones like 1 + 2 * 3 to 1 2 + 3 *.