[NEXT] [PREV]
HANDBOOK
/ GENTLE PRIMER
/ Describing Data
/Numbers and Strings 

Gentle
Applications Concepts Examples Handbook Support Download

In compilers written in Gentle most computations are carried out on terms. In addition there are builtin types for numbers and strings. The type INT comprises integer numbers. They are denoted by sequences of decimal digits. Expressions of type INT may be constructed from integer constants, variables of type INT, or by applying an operator to subexpressions. These operators are monadic plus ( +), monadic minus ( ), addition ( +), subtraction ( ), multiplication ( ), and division ( /). The operators have the usual binding strength (multiplication and division have a higher priority than addition and subtraction, the monadic operators having highest priority). Parenthesis may be used to explicitly indicate grouping. Here are some examples of INT expressions: 1024 N+1 A(BC) KThe type STRING comprises sequences of characters. Expressions of type STRING are string constants or variables of type STRING. A string constant is a character sequence enclosed in apostrophes `` "''. Inside string constants certain characters must be represented by an escape sequence: ``\"'' represents `` "'', ``\\'' represents ``\'', ``\n'' represents a newline character, and ``\t'' represents a tabulator. Here are some examples of STRING expressions: "Hello World!" "The magic word is \"needed\"." 