with Ada.Text_IO, Packrat.No_Lex, Packrat.Utilities; use Ada.Text_IO; procedure Ssss is Input : String := "xxxx"; type Parser_Labels is (S); package My_Rat is new Packrat.No_Lex (Parser_Labels, Character, String); package S_Redir is new My_Rat.Parsers.Redirect; function Match_X is new My_Rat.Parsers.Match ('x'); function S_Seq is new My_Rat.Parsers.Sequence ((Match_X'Access, S_Redir.Call'Access, S_Redir.Call'Access)); function S_Choice is new My_Rat.Parsers.Choice ((S_Seq'Access, My_Rat.Parsers.Empty'Access)); function S is new My_Rat.Parsers.Stamp (S, S_Choice); package Parser is new My_Rat.Parsers.Parse_Once (S); Result_Graph : My_Rat.Parser_Result; begin S_Redir.Set (S'Access); Result_Graph := Parser.Parse (Input); Put_Line ("Input:"); Put_Line (Input); New_Line; Put_Line ("Parser graph output:"); Put_Line (My_Rat.Parse_Graphs.Debug_String (Result_Graph)); New_Line; Put_Line ("Root tokens:"); for T of Result_Graph.Root_Elements loop Put (My_Rat.Parser_Tokens.Debug_String (T)); end loop; end Ssss;