Hello and welcome everybody.
In this lecture we are going to pause while loops so let's head over to compile h we're just going to
go to the false statement and we're going to create a statement for while loops, while statements.
And what is a well, a statement has it has an expression and a body that said, you know, we do while
one and then we have a body.
And the one is our expression, we're now going to go to positive dot C.
So now I'm going to create a new function called pause, keyword, parenthesis, expression.
So let's go void, pause, keyword, parentheses, expression that's going to take in a keyword.
We're now going to say expect keyword, keyword, expect up and we're going to go for the left bracket.
Then we're going to say parse expression of route history, begin zero four flags, and then we're going
to say expect same right bracket.
So this is basically in charge of like parsing something like that, right?
So if someone passed in while for the keyword, it would do expect keyword while.
So then we'll be left with the expression and that will expect the left bracket, which will give us
one and the right bracket.
Then we parse express for root, which will take off the one.
Finally, we expect the symbol of the right bracket, which finishes the parsing.
So now we're going to say void parse while and that's going to take in a history.
So we're going to say pause, keyword, parenthesis, expression while struck node.
Expression node equals no pop.
Now we're going to parse the body size.
RT Variable size equals zero parse body and percent variable size.
And we're going to pass in the history now we're going to say struct nodes, body nodes equals no pop.
And finally, we're going to say meg while node expression, node, body node.
And obviously, we need to create that function.
So let's head to Node C and we're going to say void mark while node struck node.
Expression node struct node body node.
No.
Create.
Ampersand struct node dot type equals node type while statement while dot statement dot while statement
dot expression node equals expression node dot statement dot while statement dot body node equals body
node.
And then we are done.
Let's now put this in compiler h.
So we're going to search for make for Node and we're just going to put it above that.
Okay.
So let's just head back to parsing dot C and we're going to go for parse keyword and we're just going
to do an LCF statement here
for the while, parse while.
So now the next step is to do a make clean and make.
And we're going to go to test at sea change this to while one.
And don't forget to save it.
And we're going to run it and we can see everything's fine.
Nice.
If we did it, it equals zero.
Everything should work.
Everything compile.
Fine.
Perfect.
So we've implemented wild statements.
Congratulations.