The chapter on compilers contains the following grammar definition and sample code.
... statement: whileStatement | ifStatement | ... // Other statement possibilities | '{' statementSequence '}' whileStatement: 'while' '(' expression ')' statement ifStatement: ... // Definition of "if" statementSequence: '' // empty sequence (null) | statement ';' statementSequence expression: ... // Definition of "expression" ... // More definitions follow
while (expression) { statement; statement; while (expression) { while(expression) statement; statement; } }
How does the loop work with the inner most code whilewithout { }? It seems to me that defining the wording requires them. Is this a mistake in the book or do I not understand the syntax?
while
{
}
[Change] I apologize for any ambiguity. Everything printed above is verbatim from the book. The passes were not my business.
Consider your code example again:
1 while (expression) { 2 statement; 3 statement; 4 while (expression) { 5 while(expression) 6 statement; 7 statement; 8 } 9 }
, 6 , , 2, 3 7 ? , while statement, a statementSequence, , statement. 5 6 , ';', .
statement
statementSequence
';'
while , ) . statement, . .
)
Source: https://habr.com/ru/post/1717182/More articles:how to control gems vs plugins loading order in Rails - pluginsPOSIXct times around DST? - dstAspect-oriented programming in r: Are any libraries available? - rIs there a good third-party job scheduling library for .Net? - c #How can I get a list from Ruby that I can list? - iteratorProgressive enhancement with Silverlight - silverlighthow to call numpad in iphone web app? - web-applicationsStream an avi file from memory using IIS / Asp.Net - asp.netcomparison / equality of two objects by protocol - objective-cIs there a way in ASP.NET MVC to handle different Response.StatusCode values? - asp.net-mvcAll Articles