Skip to main content
Version: Sprint 4

makereject

Designates a reject state for non-computational variants.

Syntax​

makereject(state);

Parameters​

  • state: The name of the state to mark as a reject state

Rules​

  • Only valid for non-computational variants (same as makeaccept)
  • Not valid for computational variant (use makehalt instead)
  • The state must be declared in makestates first
  • A state cannot be both accept and reject
  • Multiple reject states are allowed

Behavior​

When the machine enters a reject state, it halts and rejects the input.

Examples​

setvariant(single-tape);
makestates(q0, q1, qaccept, qreject);
makeinit(q0);
makeaccept(qaccept);
makereject(qreject);

Errors​

  • Wrong variant: 'makereject' is not valid for the 'computational' variant — use 'makehalt'
  • Undeclared state: state 'qreject' is not declared
  • Role conflict: state 'q0' is already marked as accept — cannot also be reject

See Also​