Parser | ![]() |
![]() |
![]() |
![]() |
The basic framework of the calculator has now been presented. Given the grammar defined in the grammar overview and the implementation of the virtual machine, we are now in a position to describe the parser that goes from the one to the other.
The simple numerical expression sin(sqrt(2)/3) was used to describe the operation of the virtual machine. Such expressions form the right hand side of any statement that can be understood by YAC. However, the grammar defining all allowable expressions is rather complex. Moreover, much of the implementation is rather repetitive. I have, therefore, chosen to begin these implementation notes with a description of the code used to parse the variable and function declarations. After all, we've all seen enough code to parse a numerical expression by now. Time to look at the stuff that enables YAC to be a programmable calculator.
![]() |
![]() |
![]() |
Copyright © 2004 Angus Leeming
Distributed under the Boost Software License,
Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
)