scanner simple = $+; digit = "0123"; //The attribute should be "RK". (note: character $0 is ascii 48) alternativeDigit = $0 .. $3; //Note: ascii 48, ... anotherAlternativeDigit = 0 .. 3; //Note: ascii 0, ... anotherAlternativeDigitAgain = 0 | 1 | 2 | 3; //Note: ascii 0, ... endOfFileCharacter = 256; space = 32 [noKeep]; //The attribute should be "R". lineEnd = 10 [noKeep]; all = "0123abc;+-/" [read keep] | space | lineEnd; //Space and lineEnd should be "R"; others "RK". nonDigit = {all - digit}; //The attributes should be "L" or "" or "K"; i.e., NOT CONTAINING R. number = digit+ => Number; // Comment = ($/ [noKeep] {all - $/} #syntaxError: ["// is a comment, / alone is not valid"]) | ($/ [noKeep] $/ [noKeep] (all [noKeep] - lineEnd [noKeep])* ( lineEnd [noKeep] | {endOfFileCharacter} ) ); //The following are ROOT building semantic actions; i.e., TOKEN BUILDING. //Also, note that parameters should be characters, integers, or strings depending //on whether their labels are #walkCharacter: #walkInteger:, or #walkString:. fsm1 = $a => "bird"; //This one should create semantic transition #buildToken: with parameters containing "bird" (NOT A TOKEN). fsm2 = $b => #buildBirdRoutine:with: [1 2]; //This one should create semantic transition #buildBirdRoutine: with parameters containing integers 1 and 2. fsm3 = $c => #between:and: [10 20]; //This one should create semantic transition #between:and: with parameters containing integers 10 and 20. fsm4 = $d => #testing; //This one should create semantic transition #testing with parameters consisting of an empty collection. //The following are NON-ROOT building semantic actions fsm5 = $e [node] #normalIncludes:and: [30 40]; //This one should create semantic transition #normalIncludes:and: with integer parameters 30 and 40. fsm6 = $f [node] #normalIncludes: [50]; //This one should create semantic transition #normalIncludes: with parameters consisting of integer 50. fsm7 = $g [node] #normalAction; //This one should create semantic transition #normalAction with parameters consisting of an empty collection.