Skip to main content
Version: Sprint 4

makeaccept

Designates an accept (final) state for non-computational variants.

Syntax​

makeaccept(state);

Parameters​

  • state: The name of the state to mark as an accept state

Rules​

  • Only valid for non-computational variants:
    • single-tape
    • multi-tape
    • multi-step
    • multi-tape-multi-step
    • nondeterministic
  • 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 accept states are allowed

Behavior​

When the machine enters an accept state, it halts and accepts the input.

Examples​

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

Multiple accept states:

makestates(q0, q1, q2, qacc1, qacc2);
makeinit(q0);
makeaccept(qacc1);
makeaccept(qacc2); ### Both are accept states

Errors​

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

See Also​