English

Nested bracket stack

Match the most recently opened unfinished bracket before an earlier one.

Adult planning suggestion: about4–6 · Logic & rule checking

Players
2–3 per group
Time
10–18 minutes
Materials
Cards( ) [ ], vertical stack mat and trace log.

Prepare

Use only round and square brackets. The stack begins empty. One learner reads symbols from left to right, one moves opening-bracket cards and one checks the top. Stack bottom is at the page bottom; the most recently pushed opening bracket is the top.

Play

On an opening bracket, push it on top. On a closing bracket, compare it with the current top: round must close round, square must close square. A match pops the top. An empty stack or wrong type at a closing bracket rejects the string immediately; do not search below the top for a convenient match.

Worked example

([]) traces empty→(→([→(→empty and is accepted. ([)] fails at the third symbol because ) cannot close top [. Equal totals of opening and closing brackets therefore do not guarantee legal nesting. (() ends with one opening bracket still on the stack.

Finish and check

Accept only if every symbol was processed without mismatch and the stack ends empty. Reject extra closers, wrong types and leftover openers. Rotate roles for four supplied strings. The empty string is accepted by this rule, although the player may begin with a nonempty practice string.

Adaptation and limits

For younger learners use just one bracket type first, with an adult reading and writing. A class of thirty can use ten trios. No speed score is needed. The reference explains stack matching; our physical cards and square-bracket extension are teaching adaptations, not a diagnosis of reading ability.

Purpose, observation and provenance

Within this activity: Match the most recently opened unfinished bracket before an earlier one.

Check top-only matching rather than just counting the two kinds of symbols.

Our rules, examples and printable diagrams are separately prepared. The earliest inventor of the broader mechanism is not established here.

Runestone — Simple Balanced Parentheses — Technical stack-matching background; our cards, second bracket type and supported younger grouping are separate choices.

Age bands are planning suggestions. Goals describe observable actions, not measured long-term gains or institutional endorsement.

Free alternative: Copy the supplied grids, labels and cards onto reused paper. No specialist product is needed. Adults may prepare pieces or act as a scribe.

Printable materials

Preview at 100% scale, with browser headers and footers off. Cut with suitable help. Keep host keys separate. This is a manual tabletop kit, not an online opponent, automatic judge or solver.

Player materials · Nested bracket stack

Inputs:([]), ([)], ((), []().

Symbol / stack before / action / stack after / accept?

(
(
(
(
)
)
)
)
[
[
[
[
]
]
]
]

Stack top↑; put newest opening card above the previous one.

Player record · keep host key separate

SymbolBeforeActionAfter
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________

Host key · separate from players

([]) and[]() accept; ([)] rejects at symbol 3; (() rejects at end with one opener.

Run the round

Use only round and square brackets. The stack begins empty. One learner reads symbols from left to right, one moves opening-bracket cards and one checks the top. Stack bottom is at the page bottom; the most recently pushed opening bracket is the top.

On an opening bracket, push it on top. On a closing bracket, compare it with the current top: round must close round, square must close square. A match pops the top. An empty stack or wrong type at a closing bracket rejects the string immediately; do not search below the top for a convenient match.

([]) traces empty→(→([→(→empty and is accepted. ([)] fails at the third symbol because ) cannot close top [. Equal totals of opening and closing brackets therefore do not guarantee legal nesting. (() ends with one opening bracket still on the stack.

Accept only if every symbol was processed without mismatch and the stack ends empty. Reject extra closers, wrong types and leftover openers. Rotate roles for four supplied strings. The empty string is accepted by this rule, although the player may begin with a nonempty practice string.

For younger learners use just one bracket type first, with an adult reading and writing. A class of thirty can use ten trios. No speed score is needed. The reference explains stack matching; our physical cards and square-bracket extension are teaching adaptations, not a diagnosis of reading ability.

Related activities

Activity library · Breadth-layer map