parser //Note: parsers don't use keep/noKeep, just read/look, stack/noStack, and node/noNode. attribute defaults "stack" "read" "noNode" "keep". keywords "stack" "noStack" "read" "look" "node" "noNode" "keep" "noKeep" "parser" "scanner". output "All". //One of All, Smalltalk, Ruby, C++, C++98, or Java //optimize "chain reductions". //NOTE: parser without quotes is a keyword; parser with quotes is a string //which will be reinterpreted as a keyword when the tables actually run //because it is output in the tables as a unique string; i.e., a symbol //which looks like an identifier. ListOfFiniteStateMachines {EndOfFile} -> GrammarType (Name '=' FiniteStateMachine ';')* => walkList: . GrammarType //Note that NO tree is built for a grammar type. -> "parser" #processTypeNow: [#parser] -> "scanner" #processTypeNow: [#scanner] . FiniteStateMachine -> Alternation -> Alternation "=>" TreeBuildingOptions => walkConcatenation: . Alternation -> => walkEpsilon: -> Concatenation -> Concatenation ("|" Concatenation)+ => walkOr: . Concatenation -> RepetitionOption -> RepetitionOption RepetitionOption+ => walkConcatenation: . RepetitionOption -> Expression -> Expression "*" => walkStar: -> Expression "?" => walkQuestionMark: -> Expression "+" => walkPlus: -> Expression "&" Expression => walkAnd: -> Expression "-" Expression => walkMinus: . Expression -> Primary -> SemanticAction => walkNonTreeBuildingSemanticAction: -> Primary "[" Attribute [node]* "]" => walkAttributes: . Primary -> "(" Alternation ")" -> "{" Alternation "}" => walkLook: -> (Name | Byte) -> Byte ".." Byte => walkDotDot:. //For scanners only TreeBuildingOptions -> Name => walkBuildTreeOrTokenFromName: //Tree if parser, Token if scanner -> "-" walkInteger: [node] => walkBuildTreeFromRightIndex: //Only for parsers. -> "+"? walkInteger: [node] => walkBuildTreeFromLeftIndex: //Only for parsers. -> SemanticAction => walkTreeBuildingSemanticAction:. Name -> walkIdentifier: [node] | walkString: [node]. Byte -> walkCharacter: [node] | walkInteger: [node]. SemanticAction -> walkSymbol: [node] => walkSemanticAction: -> walkSymbol: [node] "[" SemanticActionParameter* "]" => walkSemanticAction:. SemanticActionParameter -> Name | Byte | walkSymbol: [node]. Attribute //For parsers only: stack, noStack, node, and noNode; for scanners only: keep and noKeep. //Both read and look are for both BUT look is generally indicated by "{a}" rather than "a [look]" //and read is generally indicated by not saying it's what it is; e.g., "a" rather than "a [read]". -> ("stack" | "noStack" | "read" | "look" | "node" | "noNode" | "keep" | "noKeep") [node].