diff options
Diffstat (limited to 'ocaml-binary-annot/camlp4/examples/debug_extension.ml')
| -rw-r--r-- | ocaml-binary-annot/camlp4/examples/debug_extension.ml | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ocaml-binary-annot/camlp4/examples/debug_extension.ml b/ocaml-binary-annot/camlp4/examples/debug_extension.ml new file mode 100644 index 0000000000..21696e4a99 --- /dev/null +++ b/ocaml-binary-annot/camlp4/examples/debug_extension.ml @@ -0,0 +1,37 @@ +(* + * No debugging code at all: + * $ camlp4o -parser Camlp4DebugParser debug_extension.ml + * true + * Debugging code for lexing: + * $ STATIC_CAMLP4_DEBUG='lexing' camlp4o -parser Camlp4DebugParser debug_extension.ml + * let () = + * if Camlp4.Debug.mode "lexing" + * then Debug.printf "lexing" "TOKEN: Int %d" (2 * 21) + * else () + * in true + * + * Debugging code for lexing and parsing: + * $ STATIC_CAMLP4_DEBUG='lexing:parsing' camlp4o -parser Camlp4DebugParser debug_extension.ml + * let () = + * if Camlp4.Debug.mode "lexing" + * then Debug.printf "lexing" "TOKEN: Int %d" (2 * 21) + * else () in + * let () = + * if Camlp4.Debug.mode "parsing" + * then Debug.printf "parsing" "RULE: ..." + * else () + * in true + * + * Debugging code for any section: + * $ STATIC_CAMLP4_DEBUG='*' camlp4o -parser Camlp4DebugParser debug_extension.ml + * ... same output as above ... + * + * When you program is compiled you can use the CAMLP4_DEBUG variable to + * activate some debugging sections. + * + * CAMLP4_DEBUG_FILE manage where messages goes (default is stderr). + *) + +camlp4_debug lexing "TOKEN: Int %d" (2 * 21) in +camlp4_debug parsing "RULE: ..." in +true |
