Skip to content

Instantly share code, notes, and snippets.

@pasberth
Created August 14, 2014 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pasberth/cf611cb1c6b5b3aa692a to your computer and use it in GitHub Desktop.
Save pasberth/cf611cb1c6b5b3aa692a to your computer and use it in GitHub Desktop.
ocamlfind ocamlc -package camlp4.extend,camlp4.quotations -syntax camlp4o -c pa_hello.ml
ocamlc -pp "camlp4o ./pa_hello.cmo" hello.ml
let () = print_endline (hello "hello world")
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