[erlang-questions] Are newlines significant in Erlang grammar?

Vlad Dumitrescu vladdu55@REDACTED
Tue Dec 20 18:46:02 CET 2011


Hi,

On Tue, Dec 20, 2011 at 18:33, Ryan Molden <ryanmolden@REDACTED> wrote:
> Sure, but I was trying to avoid sprinking [\t\r\n ]* tokens everywhere
> throughout my grammar. My lexer currently ignores whitespace outside of
> comments and string literals and my parser works off the tokens my lexer
> produces.
>
> If what you are saying is correct it sounds like I can't do that, which
> means my parser's grammar explodes with tons of 'oh and there can be
> whitespace here, or needs to be whitespace here' kind of tokens :(

The issue here is that the dot is ambiguous and the rule is that a dot
followed by whitespace is the 'dot' token, while a dot followed
directly by an atom is an 'expr900' or more precisely a part of a
"packaged" atom. It is tricky that for example ".a .b .c" is a single
atom, ie whitespace is allowed before the dot but not after.
Personally I would vote for changing the package name separator (or
even remove the current package support, as it has been experimental
for many years and there are grave issues with it).

regards,
Vlad



More information about the erlang-questions mailing list