The Sol Programming Language!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.2 KiB

  1. Simple Expressions
  2. ==================
  3. Literals
  4. --------
  5. A *literal* is a leaf in an expression; it is a value in the source of a Sol program which evaluates to itself. Literals in Sol come in exactly four flavors:
  6. * Integer literals, represented by contiguous digits, possibly preceded by a
  7. negation, like `0`, `123456`, `-314159`, and the like.
  8. * Floating point literals, represented by a pair of contiguous digits separated
  9. by one radix mark, again possibly preceded by a negation, like `1.0`,
  10. `-0.256`, `999.9`, and the like.
  11. * String literals, bound on either side by a single or double quote (they must
  12. match), and containing every interim character (including newline), like
  13. `"hello world"`, `'this string has two backslashes: \\'`, and the like.
  14. Naturally, a string may not contain its own terminator, though it can be
  15. introduced by concatenating strings with different terminators.
  16. * The special literal `None`, a value only ever equal to itself and which
  17. cannot be reassigned by the user program. It is frequently used to represent
  18. the absence of a value, such as the value of a function which does not
  19. explicitly return a value.
  20. The following source fragment demonstrates some of the literals::
  21. a = 123