The grammar of expressions

The Backus-Naur Form (BNF) notation is used to specify the grammar for programming languages. The semantics of BNF can be learned from books, and plenty of material is available. The grammar of the expression evaluator we use is as follows:

    <Expr> ::= <Term> | Term { + | - } <Expr> 
    <Term> ::= <Factor> | <Factor> {*|/} <Term> 
    <Factor>::= <number> | ( <expr> ) | {+|-} <factor> |  
                SIN(<expr>) | COS(<expr>) | $t 

This BNF can be converted to source code very easily.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.200.71