Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
When most people think of learning a new programming language, they first think of syntax. Syntax is what makes languages look different from each other; indeed, it’s often a reason why some people like (or dislike!) certain languages.
Syntax, however, is only skin-deep. Concrete syntax, which is the rules that the language imposes on the programmer in terms of what each construct looks like, isn’t that important. Compilers generate a data structure called an abstract syntax tree after parsing the code written in the concrete syntax of the language. The source code of the program is discarded once the AST (abstract syntax tree) is generated. For all other phases of compilation (for example, semantic analysis), only the AST is required. You might say, therefore, that concrete syntax is fundamentally for humans. That’s not to say that human convenience isn’t important, but syntax shouldn’t get in the way of what’s possible with a computer language. (We’ll revisit this issue in section 1.3.1.)