Language Overview
The fla-- Language is a declarative language for describing Turing machines. It provides a concise, human-readable syntax for defining machine states, alphabets, transitions, and behavior variants.
Structure
A fla-- program consists of three main sections that must appear in order:
- Settings - Machine configuration (variant, tape count)
- Declarations - States, alphabets, and markers
- Transitions - State transition rules
Basic Syntax
Every statement in fla-- follows a function-call pattern:
functionName(arg1, arg2, ...);
Statements are separated by semicolons. Function names are case-insensitive, but state names and alphabet symbols are case-sensitive.
Comments
fla-- supports two types of comments:
Single-line Comments
Use ### for single-line comments:
setvariant(single-tape); ### This is a comment
Multi-line Comments
Use """ for block comments that span multiple lines:
"""
This is a multi-line comment.
It can span several lines.
"""
setvariant(single-tape);
Minimal Example
setvariant(single-tape);
setalpha(0, 1);
makestates(q0, q1);
makeinit(q0);
makeaccept(q1);
maketransitions(
q0, 0 -> q0, 0, R;
q0, 1 -> q0, 1, R;
q0, _ -> q1, _, S;
);
This machine accepts any string of 0s and 1s.
Key Concepts
- Variant: Determines the type of Turing machine (single-tape, multi-tape, computational, etc.)
- States: Named configurations the machine can be in
- Alphabet: Symbols that can appear on the tape
- Transitions: Rules that determine how the machine moves between states
- Markers: Special states (initial, accept, reject, halt)
Documentation Sections
- setvariant - Set the machine variant
- settapecount - Configure tape count for multi-tape variants
- setalpha - Define the tape alphabet
- setblank - Define the blank symbol
- makestates - Declare machine states
- makeinit - Designate the initial state
- makeaccept - Designate an accept state
- makereject - Designate a reject state
- makehalt - Designate a halt state
- maketransitions - Define transition rules
- Variants - Detailed explanation of each variant type
- Examples - Complete example machines