Skip to content

Commit 77b2550

Browse files
committed
Some more doc in HACKING.md
1 parent dbdf4df commit 77b2550

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

HACKING.md

+21
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,27 @@ just run `make coverage` and it should open the coverage report in a browser
8585
window for you (via xdg-open).
8686

8787

88+
## Guidelines and coding recommandations
89+
90+
This section sums up useful guidelines and recommendations conerning the various
91+
parts of the code.
92+
93+
### Lexers
94+
95+
- Lexers should alwyas have a fallback case that raises the `Error` exception
96+
(else, ocamllex-generated parsers raise weird errors when no match can be found)
97+
98+
### Parsers
99+
100+
- In general, parsers should be as simple as possible and, as much as possible
101+
strive to only generate a structured representation of the input, without doing
102+
anything smart or semantic-related. Instead, most (if not all) of the processing
103+
should be done during typechecking. For instance, if a language does not define
104+
a specific syntax rule for equality, and instead just treat equality as a regular
105+
application (either a regular prefix application, or a generic infix appllication),
106+
then a parser should generate a regular application node (and **not** use the `Equal`
107+
builtin).
108+
88109

89110
## Hand-written syntax error messages
90111

0 commit comments

Comments
 (0)