ocamlfind ocamlc -package camlp4.extend,camlp4.quotations -syntax camlp4o -c pa_hello.ml
ocamlc -pp "camlp4o ./pa_hello.cmo" hello.ml
Created
August 14, 2014 05:31
-
-
Save pasberth/cf611cb1c6b5b3aa692a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let () = print_endline (hello "hello world") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Id : Camlp4.Sig.Id = struct | |
let name = "HelloWorld" | |
let version = "1.0" | |
end | |
module Make (Syntax : Camlp4.Sig.Camlp4Syntax) = struct | |
include Syntax | |
EXTEND Syntax.Gram | |
expr: | |
[[ "hello"; x = expr -> x ]] | |
; | |
END | |
end | |
module M = Camlp4.Register.OCamlSyntaxExtension(Id)(Make) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment