Lexical Elements of Commands

After the debugger assembles complete lines of input from the characters it reads from stdin or from the file specified in the source command (as described in Entering and Editing Command Lines), each line is then converted into a sequence of lexical elements known as lexemes. For example, print(a++); is converted into the following lexemes:

  1. print
  2. (
  3. a
  4. ++
  5. )
  6. ;

The sequence of lexemes is then recognized as debugger commands containing language-specific expressions by a process known as parsing. The recognition is based on a set of rules known as a grammar. The debugger uses a single grammar for commands regardless of the current program's language, but it has language-specific subgrammars for some of the pieces of commands, such as names, expressions, and so on.