Comments (3)
As in many C-family languages, the grammar of a for
loop is basically:
<for-stat> ::= "for" "(" <stat> ";" <expr> ";" <expr> ")" <stat>
So the body of a for
loop can be a single statement:
for (var x = 0; x < 10; x = x + 1)
trace x;
It just happens that one possible statement type is the block statement:
for (var x = 0; x < 10; x = x + 1) {
trace x;
trace (x + 1);
}
The same is true for other control flow statements such as if
, while
, when
, and atomic
.
from hap.
It is clear to me after looking at it for second time.
I was thinking that you checked for accept(Token::LEFT_BRACE) before calling the below. I was indeed I error. Thanks for explaining
const auto body(accept_statement(environment));
from hap.
Thanks
On Oct 24, 2016 5:06 AM, "Jon Purdy" [email protected] wrote:
As in many C-family languages, the grammar of a for loop is basically:
::= "for" "(" ";" ";" ")"
So the body of a for loop can be a single statement:
for (var x = 0; x < 10; x = x + 1)
trace x;It just happens that one possible statement type is the block statement:
for (var x = 0; x < 10; x = x + 1) {
trace x;
trace (x + 1);
}The same is true for other control flow statement such as if, while, when,
and atomic.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#9 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAaRp6TST7fvo8PJR67nJbZ-8l8iagxks5q3C63gaJpZM4KeQen
.
from hap.
Related Issues (12)
- Environments are copied excessively. HOT 1
- Switch to push-based semantics.
- Add game-related features.
- Removing Tokens HOT 2
- Function values aren’t callable. HOT 1
- Asynchronous control flow operators aren’t implemented. HOT 2
- Many things are non-const which ought to be const.
- Pointers want to be functors.
- Tokenizer isn’t unit tested. HOT 1
- Parser isn’t unit tested. HOT 2
- Tokenizer and parser don’t track source positions.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hap.