Variables, Types, and Expressions

Basics

PDS has two primitive types, string, and floating-point number, with the usual notations. You need not declare variables. Variables can take on values of different types over time. To dereference a variable, precede its name with a dollar sign. Values are converted to the appropriate type depending on context. For instance, a string is converted to a number when it appears in an arithmetic expression. The grammar forbids certain combinations of expressions to catch common mistakes. Some examples:

a = 5.2
b = "2.5"
c = $a + $b            # succeeds, value is 7.7
d = 5.2 + "2.5"        # disallowed by the grammar