Conditional Macros

Richard Carlsson <>
Fri Aug 11 13:22:49 CEST 2006


theeepan wrote:
> Theepan: The PP runs even before Lexical analysis phase in
> many passes and I thought PP macros are not presented to the
> parser?

And they aren't. But the preprocessor is token based: it reads
the input one section at a time, tokenises it, processes
pp-directives and expands macros, and finally the modified token
sequence is parsed.

When you write expressions in the Erlang shell, the same thing
happens (but without preprocessor): the scanner keeps reading
your input until you write a '.' followed by whitespace, then
the shell parses and executes your expression, then it goes back
to reading more input.

	/Richard




More information about the erlang-questions mailing list