3.1.5 Identifiers

Types must be identifiers

The name of the type must be an identifier. That is, it must follow certain rules.

Definition of identifier

An identifier, in Prolog+CG, is any sequence of:

  • The letters A-Z and a-z
  • Digits (0-9)
  • Underscores (_)

The first two characters must be letters.


For example, the following are all identifiers:

  • Albert
  • abc
  • xxOrange
  • ab
  • colorful_rainbow
  • the_little_R2D2
  • the_eloquent_C3P0
  • Paris2

These are all identifiers because they conform to the rule given above.


However, the following are not identifiers:

  • c3po (because the first two are not letters)
  • _a (because the first two are not letters)
  • this.here.has.periods (because it does not consist only of letters, digits, and underscores)
  • a (because the first two are not letters; there is no second)


Thus an identifier is a sequence of letters, digits, and underscores, where the first two characters are letters.


Next, we give more hints and further rules for constructing type-hierarchies.

PrevLite: 3.1.4 Universal and Absurd
NextLite: 3.1.6 Further rules

Prev: 3.1.4 Universal and Absurd
Up: 3.1 Concept types and type-hierarchies in Prolog+CG
Next: 3.1.6 Further rules