On Sat, Jul 29, 2017 at 10:43 PM Andy Balholm <andybalh...@gmail.com> wrote:

> It’s not quite true that the compiler doesn’t care about white space. The
lexer is part of the compiler, and it does care about white space. The
semicolon insertion rule, in particular, pays attention to newlines. So,
while the compiler doesn’t care about indentation at all, there are some
brace/indentation styles that it will not accept. One of those is Allman
style.

That's why it was compared to the processing according to the C
specification. Only at phase 7 is "The resulting tokens are syntactically
and semantically analyzed and translated as a translation unit." performed.
The previous 6 phases used to be actually a separate program/programs
running before the compiler (phase 7) was invoked. Putting it all in one
black box does not necessarily blur the conceptual separation. Most
compilers _can_ work without a lexer, they could directly consume token
sequences just happily. It's just no more practical to separate the pieces.

-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to