CRA.def 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. DEFINITION MODULE CRA;
  2. (* Automaton and Scanner Generation *)
  3. IMPORT FileIO;
  4. CONST
  5. MaxSourceLineLength = 78;
  6. TYPE
  7. PutSProc = PROCEDURE (ARRAY OF CHAR);
  8. PROCEDURE CopyFramePart (stopStr: ARRAY OF CHAR; VAR leftMarg: CARDINAL;
  9. VAR framIn, framOut: FileIO.File);
  10. (* "stopStr" must not contain "FileIO.EOL".
  11. "leftMarg" is in/out-parameter -- it has to be set once by the
  12. calling program. *)
  13. PROCEDURE ImportSymConsts (putS: PutSProc);
  14. (* Generates the import list for the eventually existing named constants. *)
  15. PROCEDURE ConvertToStates (gp, sp: INTEGER);
  16. (* Converts top-down graph with root gp into a subautomaton that
  17. recognizes token sp *)
  18. PROCEDURE MatchDFA (s: ARRAY OF CHAR; sp: INTEGER; VAR matchedSp: INTEGER);
  19. (* Returns TRUE, if string s can be recognized by the current DFA.
  20. matchedSp is the token as that s can be recognized. *)
  21. PROCEDURE MakeDeterministic (VAR ok: BOOLEAN);
  22. (* Converts the NFA into a DFA. ok indicates if an error occurred. *)
  23. PROCEDURE NewComment (from, to: INTEGER; nested: BOOLEAN);
  24. (* Defines a new comment for the scanner. The comment brackets are
  25. represented by the mini top-down graphs with the roots from and to. *)
  26. PROCEDURE WriteScanner (VAR ok: BOOLEAN);
  27. (* Emits the source code of the generated scanner using the frame file
  28. scanner.frm *)
  29. PROCEDURE PrintStates;
  30. (* List the automaton for tracing *)
  31. END CRA.