Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> parse and evaluate infix notation expressions

Wirth's "Pascal User Manual and Report" has a listing of a program on pg 75 that does just that. Except it emits the expressions in postfix form rather than evaluating them. It's 31 lines of code, including declarations and `end` statements.

K+R "The C Programming Language" has a desk calculator that evaluates postfix form on pages 74-75 which is about 60 lines of code including lines with just a {, and handles +-*/= including user interface and error checking.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: