@@ -11,61 +11,59 @@ Make an .ml-file:
11
11
12
12
This gets parsed to the following syntax tree :
13
13
14
- $ ocamlc -dparsetree test. ml
15
- [
16
- structure_item (test. ml[1 ,0 + 0].. [3 ,88 + 50])
17
- Pstr_value Nonrec
18
- [
19
- <def >
20
- pattern (test. ml[1 ,0 + 4].. [1 ,0 + 6])
21
- Ppat_construct " ()" (test. ml[1 ,0 + 4].. [1 ,0 + 6])
22
- None
23
- expression (test. ml[1 ,0 + 9].. [3 ,88 + 50])
24
- Pexp_match
25
- expression (test. ml[1 ,0 + 15].. [1 ,0 + 31])
26
- Pexp_apply
27
- expression (test. ml[1 ,0 + 15].. [1 ,0 + 16])
28
- Pexp_ident " !" (test. ml[1 ,0 + 15].. [1 ,0 + 16])
29
- [
30
- <arg >
31
- Nolabel
32
- expression (test. ml[1 ,0 + 16].. [1 ,0 + 31])
33
- Pexp_ident " Sys.interactive" (test. ml[1 ,0 + 16].. [1 ,0 + 31])
34
- ]
35
- [
36
- <case >
37
- pattern (test. ml[2 ,37 + 4].. [2 ,37 + 9])
38
- Ppat_construct " false" (test. ml[2 ,37 + 4].. [2 ,37 + 9])
39
- None
40
- expression (test. ml[2 ,37 + 13].. [2 ,37 + 50])
41
- Pexp_apply
42
- expression (test. ml[2 ,37 + 13].. [2 ,37 + 26])
43
- Pexp_ident " print_endline" (test. ml[2 ,37 + 13].. [2 ,37 + 26])
44
- [
45
- <arg >
46
- Nolabel
47
- expression (test. ml[2 ,37 + 27].. [2 ,37 + 50])
48
- Pexp_constant PConst_string(" Running in batch mode" ,(test. ml[2 ,37 + 28].. [2 ,37 + 49]),None)
49
- ]
50
- <case >
51
- pattern (test. ml[3 ,88 + 4].. [3 ,88 + 8])
52
- Ppat_construct " true" (test. ml[3 ,88 + 4].. [3 ,88 + 8])
53
- None
54
- expression (test. ml[3 ,88 + 13].. [3 ,88 + 50])
55
- Pexp_apply
56
- expression (test. ml[3 ,88 + 13].. [3 ,88 + 26])
57
- Pexp_ident " print_endline" (test. ml[3 ,88 + 13].. [3 ,88 + 26])
58
- [
59
- <arg >
60
- Nolabel
61
- expression (test. ml[3 ,88 + 27].. [3 ,88 + 50])
62
- Pexp_constant PConst_string(" Running interactively" ,(test. ml[3 ,88 + 28].. [3 ,88 + 49]),None)
63
- ]
64
- ]
65
- ]
66
- ]
67
-
68
-
14
+ ; $ ocamlc -dparsetree test. ml
15
+ ; [
16
+ ; structure_item (test. ml[1 ,0 + 0].. [3 ,88 + 50])
17
+ ; Pstr_value Nonrec
18
+ ; [
19
+ ; <def >
20
+ ; pattern (test. ml[1 ,0 + 4].. [1 ,0 + 6])
21
+ ; Ppat_construct " ()" (test. ml[1 ,0 + 4].. [1 ,0 + 6])
22
+ ; None
23
+ ; expression (test. ml[1 ,0 + 9].. [3 ,88 + 50])
24
+ ; Pexp_match
25
+ ; expression (test. ml[1 ,0 + 15].. [1 ,0 + 31])
26
+ ; Pexp_apply
27
+ ; expression (test. ml[1 ,0 + 15].. [1 ,0 + 16])
28
+ ; Pexp_ident " !" (test. ml[1 ,0 + 15].. [1 ,0 + 16])
29
+ ; [
30
+ ; <arg >
31
+ ; Nolabel
32
+ ; expression (test. ml[1 ,0 + 16].. [1 ,0 + 31])
33
+ ; Pexp_ident " Sys.interactive" (test. ml[1 ,0 + 16].. [1 ,0 + 31])
34
+ ; ]
35
+ ; [
36
+ ; <case >
37
+ ; pattern (test. ml[2 ,37 + 4].. [2 ,37 + 9])
38
+ ; Ppat_construct " false" (test. ml[2 ,37 + 4].. [2 ,37 + 9])
39
+ ; None
40
+ ; expression (test. ml[2 ,37 + 13].. [2 ,37 + 50])
41
+ ; Pexp_apply
42
+ ; expression (test. ml[2 ,37 + 13].. [2 ,37 + 26])
43
+ ; Pexp_ident " print_endline" (test. ml[2 ,37 + 13].. [2 ,37 + 26])
44
+ ; [
45
+ ; <arg >
46
+ ; Nolabel
47
+ ; expression (test. ml[2 ,37 + 27].. [2 ,37 + 50])
48
+ ; Pexp_constant PConst_string(" Running in batch mode" ,(test. ml[2 ,37 + 28].. [2 ,37 + 49]),None)
49
+ ; ]
50
+ ; <case >
51
+ ; pattern (test. ml[3 ,88 + 4].. [3 ,88 + 8])
52
+ ; Ppat_construct " true" (test. ml[3 ,88 + 4].. [3 ,88 + 8])
53
+ ; None
54
+ ; expression (test. ml[3 ,88 + 13].. [3 ,88 + 50])
55
+ ; Pexp_apply
56
+ ; expression (test. ml[3 ,88 + 13].. [3 ,88 + 26])
57
+ ; Pexp_ident " print_endline" (test. ml[3 ,88 + 13].. [3 ,88 + 26])
58
+ ; [
59
+ ; <arg >
60
+ ; Nolabel
61
+ ; expression (test. ml[3 ,88 + 27].. [3 ,88 + 50])
62
+ ; Pexp_constant PConst_string(" Running interactively" ,(test. ml[3 ,88 + 28].. [3 ,88 + 49]),None)
63
+ ; ]
64
+ ; ]
65
+ ; ]
66
+ ; ]
69
67
70
68
71
69
Let's first compile and run the example
0 commit comments