<div dir="ltr">Hi!<div><br></div><div>This is related to the new EEP 44, but different. That discusson made clear something that has been bothering me for a while, but I couldn't put my finger on it.</div><div><br></div><div>The preprocessor runs in two different stages: one that handles -include and macros, and one that handles conditional compilation. Because of the restrictions that macros can't be multi-form and that conditional markers have to be well-formed inside one file, the latter stage is basically a parser, albeit a simpler one than erl_parse. Instead of building a complete tree, it throws away the parts that aren't used. In the current implementation, these stages are intertwined, as the lexing and parsing are done in lock-step.</div><div><br></div><div>I wonder: would it be worth to separate these stages completely? The first stage is the one that few people like and many complain about. The latter is useful. </div><div><br></div><div>In conclusion, what if the preprocessor is split in two and the second pass can be configured to return the whole tree, with the chunks guarded by conditional expressions? I think all tools that handle raw source code would benefit from having access to the actual processor instead of writing their own. The two smaller tools will probably be easier to maintain, too.<br></div><div><br></div><div>best regards,</div><div>Vlad</div><div><br></div></div>