Commits

johannes  committed 6127b1f

Initial revison.

  • Participants

Comments (0)

Files changed (4)

+syntax: glob
+*.cmi
+*.cmo
+*.cmx
+*.o
+*.annot
+testref
+SYNTAX=newref
+TARGET=testref
+
+$(TARGET): $(TARGET).ml $(SYNTAX).cmo
+	ocamlopt -o $(TARGET) -pp 'camlp4o -I . $(SYNTAX).cmo' $<
+
+$(SYNTAX).cmo: $(SYNTAX).ml
+	ocamlc -I +camlp4 camlp4lib.cma -pp camlp4orf -c $<
+
+clean:
+	rm -f *.cmi *.cmo *.cmx *.o *.annot $(TARGET)
+open Camlp4.PreCast
+open Syntax
+
+EXTEND Gram
+	expr: BEFORE "~-"
+	    [ [ "$" ; m = SELF ->
+			  <:expr< ! $m$ >>
+		] ]
+	;
+END
+let a = ref "old" in
+(* Old syntax *)
+Printf.printf "%s\n" !a;
+Printf.printf "%s\n" !(a);
+Printf.printf "%s\n" (!(a));
+Printf.printf "%s\n" (!a);
+Printf.printf "%s\n" ! a;
+Printf.printf "%s\n" ! (a);
+Printf.printf "%s\n" ( ! (a));
+Printf.printf "%s\n" ( ! a);
+
+a := "new";
+(* New syntax *)
+Printf.printf "%s\n" $a;
+Printf.printf "%s\n" $(a);
+Printf.printf "%s\n" ($(a));
+Printf.printf "%s\n" ($a);
+Printf.printf "%s\n" $ a;
+Printf.printf "%s\n" $ (a);
+Printf.printf "%s\n" ( $ (a));
+Printf.printf "%s\n" ( $ a);