Logiweb(TM)

7.1.6.1 Numerals

Prev Up Next Page 141 of 800 Search internet


As mentioned previously, space characters are treated a bit different from other characters in that an arbitrary sequence of space and newline characters count as a single space. Apart from that, space characters are treated like any other character.

Consider the following lgs source text:

   ""P my page
   ""D 0
   0
   1
   2
   3
   4
   5
   6
   7
   8
   9
   ""D 2
   0"
   1"
   2"
   3"
   4"
   5"
   6"
   7"
   8"
   9"
   ""D 6
   " + "
   ""B
   123 + 456

In this case, the body reads:

[1[2[3]]] + [4[5[6]]]

The charge sections above define a grammar with ten nullary constructs (0 to 9), ten unary constructs (0" to 9"), and one binary construct (" + "). The unary constructs are 'gluing' in the sense that there is no space between the digit and the double quote. For that reason, there can be no spaces between digit and parameter when using the construct.

The example above shows how the syntax of numerals is implemented by the base page. The base page also provides macro and value definitions of the constructs which ensure that e.g. 17 ends up having a value of seventeen.

Bodies of Logiweb pages are built up from strings, escapes, user defined grammatical constructs, and nothing else. Even numerals are user defined.

Prev Up Next Page 141 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05