Formal Languages

Sets of sequences of symbols

Alphabet

Definition

An alphabet () is a finite set of symbols

Examples

Word

Definition

A word over is a finite sequence of symbols from

Examples

  • 01101 (5 symbols)
  • 42 (2 symbols)
  • def var (2 symbols)
  • The "empty word" (0 symbols)

Language

Definition

A language is a set of words (can be infinite)

Examples

  • All strings of 32 bits (finite)
  • All prime numbers written in decimal (infinite)
  • All valid Lacs programs
  • All correct solutions to assignment 6
  • empty language
  • the language containing the empty word

Language Class

Definition

A language class is a set of languages

Example

  • Finite languages

  • Regular languages

  • Context-free languages

  • Decidable languages

    • There exists an algorithm to decide if a word exists in the language or not
  • Undecidable languages

All finite languages are regular, all regular languages are context-free, and all context-free languages are decidable, i.e