[$name|CalculatorDynamic$]
[$title|Calculator Dynamic$]
[$frame|HTMLPage.tmpl$]
[$desc|A simple command-line arithmetic calculator utilizing a calculator grammar.
Demonstrates how to use Goldie's dynamic-style.$]

<p>
A simple arithmetic calculator utilizing a
[$link|http://www.dsource.org/projects/goldie/browser/tags/v0.4/lang/calc.grm|calculator grammar$].
Demonstrates how to use Goldie's [$pageLink|StatVsDyn|dynamic-style$].
</p>

<p>
[$link|http://www.dsource.org/projects/goldie/browser/tags/v0.4/src/samples/calculatorDynamic/main.d|Calculator Dynamic Source Code$]
</p>

<h3>Sample run:</h3>

<div class="code-plain">&gt;[$code|user|goldie-calculatorDynamic$]
Calculator
Loading language...done!
Enter an arithmetic expression ('exit' to exit)

calculator&gt;[$code|user|2+2*20$]
42.00000

calculator&gt;[$code|user|(1-3) / 2$]
-1.00000

calculator&gt;[$code|user|10$]
10.00000

calculator&gt;[$code|user|[:12 {;[ 456 qwf:]$]
(1:4): Syntax Error: [:'{;[':]
(1:12): Syntax Error: 'qwf'
2 Error(s)

calculator&gt;[$code|user|2 + * 7$]
(1:5): Unexpected *: '*'

calculator&gt;[$code|user|-10 * -20$]
200.00000

calculator>[$code|user|exit$]</div>
