Vocabulary coding helps teenagers see how words can serve as reusable building blocks in a structured language. A formal grammar specifies how symbols may be combined to create expressions in a defined language. A learner can build a tiny grammar, examine which expressions follow it, and attach a specified interpretation to each accepted instruction. This is a practical bridge between ordinary vocabulary, formal reasoning and computer programming.
Natural language contains richer contextual, cultural and pragmatic meanings than a small formal grammar can capture. EduKate’s language engineering laboratory therefore begins with a restricted, fictional language for drawing marks on a paper grid. The goal is not to replace ordinary conversation with code. It is to learn how syntax, semantics, validation and execution differ, and how carefully defined vocabulary can become a reusable intellectual tool.
- Distinguish tokens, grammar rules and interpretations.
- Define a bounded mini-language with a clear vocabulary.
- Test valid and invalid instructions before interpreting them.
- Distinguish syntactic validity from semantic suitability and permission.
- Extend a grammar while preserving previously intended meanings.
Chapter navigation
- 1. The vocabulary is not the grammar
- 2. Write the grammar in a readable form
- 3. Syntax and semantics answer different questions
- 4. Worked execution on a paper grid
- 5. A valid sentence can have an invalid operation
- 6. Ambiguity and structure
- 7. Design a conformance test suite
- 8. Extend the language carefully
- 9. Human–AI and civilisation zoom
- 10. Four-week formal-language studio
- 11. Continue learning in the eduKate vocabulary ecosystem
The vocabulary is not the grammar
Suppose a fictional drawing language has the words MOVE, MARK, NORTH, SOUTH, EAST and WEST, plus the numerals 1, 2 and 3. Knowing these tokens does not tell us whether MARK EAST 2 is allowed or what it would mean. A grammar specifies the permitted combinations.
Choose two instruction forms: MOVE followed by a direction and a distance, or MARK followed by nothing. Treat spaces as separators. The interpreter moves a paper marker or records a mark at its current position. No actual equipment is involved. The language is deliberately restricted so its meaning can be tested completely for short cases.
Write the grammar in a readable form
In an informal notation inspired by Backus–Naur Form, define Instruction as MOVE Direction Distance or MARK. Direction is NORTH, SOUTH, EAST or WEST. Distance is 1, 2 or 3. A sequence consists of one or more instructions separated by semicolons. Uppercase words here are literal tokens, while Instruction, Direction and Distance are names of grammar rules.
The W3C XML specification uses a formal grammar notation to define permitted structures. Our classroom notation is a simplified illustration rather than an XML implementation. Writing the rules explicitly helps another learner decide whether a sequence belongs to the invented drawing language.
Syntax and semantics answer different questions
MOVE EAST 2 is syntactically valid. Its interpretation is to move the marker two grid units east. MARK is syntactically valid and means record a mark at the current position. MOVE 2 EAST is invalid under our grammar, although a person might guess what was intended.
A learner should not confuse a malformed expression with an impossible or unsafe operation. The syntax checks how tokens are arranged; the semantics specifies their interpretation. Further constraints determine whether an operation can be carried out in the current state.
Worked execution on a paper grid
Define a five-by-five grid with coordinates from zero through four in both directions. Begin at (1,1), with east increasing the first coordinate and north increasing the second. Execute MOVE EAST 2; MARK; MOVE NORTH 1; MARK. The first move reaches (3,1), which is marked. The second move reaches (3,2), which is also marked.
The expected final position is (3,2), with marks at (3,1) and (3,2). A willing reader can reproduce the sequence on graph paper. These are calculated expectations for the invented model, not observed results from an actual software implementation.
A valid sentence can have an invalid operation
From (3,2), MOVE EAST 3 is syntactically valid but would reach (6,2), outside the defined grid. Specify a semantic constraint: if a move would leave the grid, stop and report an out-of-bounds instruction without moving the marker. Preserve the previous valid position and marks.
This distinction is important in larger systems. A perfectly formed instruction does not necessarily satisfy all preconditions. Nor does syntax establish authority to execute an operation. In this paper exercise the consequence is small; real systems require appropriate technical controls and human review.
Ambiguity and structure
Suppose the grammar is extended to allow REPEAT 2 followed by a group of instructions. The expression REPEAT 2 MOVE EAST 1; MARK could mean repeat only the move and then mark, or repeat the move and mark together, unless the scope is specified. Add explicit grouping delimiters to distinguish those constructions.
Test the two intended forms separately. Starting at (0,0), two moves followed by one mark produces a mark only at (2,0). Repeating the move-and-mark pair produces marks at (1,0) and (2,0). The final position is the same, but the recorded output differs. Structure changes meaning even when the vocabulary is almost identical.
Design a conformance test suite
Prepare valid commands, malformed commands, invalid tokens, boundary moves and grouped repetitions. Write expected outcomes before asking another reader or machine to process them. For the original non-repeating grammar, the single-instruction vocabulary has twelve possible MOVE combinations and one MARK instruction.
The number of possible instruction sequences is unbounded if arbitrary sequence lengths are permitted. Testing all thirteen single instructions therefore does not exhaust all programmes. Include representative multi-instruction sequences and state the tested limits. A grammar test establishes only the specified property of the language or implementation.
Extend the language carefully
If a new token ERASE is added, specify whether it removes a mark at the current position, removes all marks or performs another operation. Do not assume that a familiar English word has a unique executable meaning. Add the grammar rule, define the semantics and create tests for the new operation.
Rerun earlier examples to see whether their intended interpretations remain stable. Preserve the previous version and explain any deliberate changes. This is vocabulary engineering at the edge: expanding a language while protecting the intellectual structures that already work.
Human–AI and civilisation zoom
A permitted AI can help generate candidate expressions or a small parser for this fictional grid language. Ask it to distinguish grammar validation from interpretation and state constraints. Verify expected positions and marks on paper before trusting generated code. Use no actual robotics controls, private records or external action permissions.
Across institutions, formal languages can support exchange and execution of selected procedures. EduKate’s portable civilisation framework benefits when a language’s vocabulary, syntax, semantics, inputs and limitations remain accessible to new users. Human communities also rely on judgement, culture, skills and governance. A formal grammar supports a bounded part of communication rather than reproducing the whole of human meaning.
Four-week formal-language studio
At 13 distinguish words and sentence patterns; at 14 define a small vocabulary; at 15 construct a grammar; at 16 test semantic constraints; at 17 design a controlled extension; at 18 document a tested interpreter specification and version history. These are flexible learning stages.
Week one: define the grid and basic instructions. Week two: write grammar and interpretation rules. Week three: test examples with a willing reader, including malformed and out-of-bounds cases. Week four: add one operation, rerun earlier tests and prepare a handover. Record actual outcomes, and distinguish calculated expectations from observed implementation results.
