RosettaCodeData/Task/Odd-word-problem/Nom/odd-word-problem.num
2025-08-11 18:05:26 -07:00

23 lines
444 B
Text

#*
GRAMMAR PARSE TOKENS
no tokens required, except to store odd/even state
HISTORY
13 sept 2021: written
*#
begin { add "odd*"; push; }
read;
[:alpha:] {
pop;
B"odd*" { push; get; put; clear; }
B"even*" { push; swap; get; put; clear; }
}
![:alpha:].!"" {
pop;
B"odd*" { replace "odd*" "even*"; push; }
B"even*" { replace "even*" "odd*"; push; }
swap; print; clear; swap; print; clear;
}
(eof) { get; print; }