Calculator

Top  Previous  Next

Examples > Calculator

 

You should know the most essential operation elements of TETRA.

 

Problem definition:

 

Arithmetical problems like "(3.2 + 8.9 - 4.6) * 5.6" shall be calculated.

 

TETRA Program:

 

This is a classical application of a parser. The numbers, operators and parenthesis have to be extracted from the input to calculate the result. The project consists of several tokens and five productions, which will be explained on the next pages.

 

This project again exists in two versions:

 

a) The first version demonstrates the use of parameter references and

 

\TextTransformer\Examples\Calculator\Calculator1.tpp

 

b) A second uses return values

 

\TextTransformer\Examples\Calculator\Calculator2.tpp

 

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German