Raw

1. Objective / Мета роботи

Design and implement a finite state machine that scans a string and extracts numbers from it, in four stages of increasing capability.

By the end of the work the student should be able to:

  • describe a finite state machine by its states, input alphabet, transition rules, start state, and accepting states;
  • scan a string character by character, classifying each character and driving the machine’s state;
  • recognise, in growing order of difficulty, all digits, all integers, all positive rational numbers, and all (signed) rational numbers in a string;
  • express the scanner as a transition table or state diagram and translate it into code;
  • reason about the scanner’s linear time complexity in the length of the input.

The work connects the abstract model of automata to a concrete, everyday task — tokenising text — and lays the groundwork for lexical analysis in compilers.

Laboratory/Laboratory8/1purpose.md · 1.0 KB · updated 2026-07-31 21:14