How's everybody doing this morning? Good to see you. Good morning, Randy. Good to see you, Norman, Michael, everybody. Hello, everybody on YouTube and Facebook. Good to see you all. Welcome back. What a great day yesterday. I want to talk a little bit about what happened with egg.  I was a little disappointed yesterday. I thought we were going to have a slow day and end up being a phenomenal day when I talk a little bit about it. There's one stock also going to talk about the CARV that's also popping up on the swatch list this morning. You can see some of you basically saw the stock this morning, had a nice little pop early, had a really nice move at 7 a.m. and really made a nice move up until about 8 o'clock, so we're going to check that one out. So with that said, everyone, I just want to remind everybody, next week, I'm going, actually today, 12 o'clock, we got open house here at Cybertree University. Please go out to share us, like us, tell everybody, invite them in, show them why it's so important you got to learn before you can earn. So I want to invite all of you guys to come here. So please go out there. We'll just put the link up in the trading room. Also, next week, I'm going to be on Well365 talking about a lot of these high-frequency trades and algorithms and stuff like that. Don't miss that opportunity. If you're a student, please register because, you know what, there's going to be some really good presenters there. You can always email me.  So please go out there and register. But before we start going through the watch list, I just want to start with the biggest loser of the day for a reason. And that is New Egg. New Egg, my God, let me just blow this thing up really quick right here. So New Egg, all right, out of nowhere. I've been, we've been watching this stock and you know that being in the cyber group room. I'm looking at New Egg and it wasn't going anywhere. And it was like, let me just bring up a couple of days over here on the intro day, you could see here. So you could see right here, New Egg was like, it was hovering right around here. You could see right here, it was like $16. It was actually a 10. If I bring up the long-term chart, you'll see what I'm talking about. Here's a long-term chart. So it really isn't gone anywhere. It was hovering around this $10 price range. And then all of a sudden, it had this big spike right here. It went from 11 to about to 20. And then it kind of like held. I'm like, you know what? Started building a little bit of a Falstow flag. So let me bring up the long-term chart here. I mean, the short-term chart, the one minute chart.  And then yesterday, I mean, it was off to the races. So you could see it right there. It just literally popped and went to like 32. And you gotta think about this for a second. The stock was at 27. It ran to 32. Built a really nice Falstow flag. Let me zoom in over here so you guys can see a little bit better right there. And then it did a shake. And let me tell you, this thing was a category five. All right, then it just popped. Went up to like 38. Like, my God, it's only 9.45. And then all of a sudden did its little shake, which we know it's very important to know these shakes and why they do them. We covered that in our class. And then boom, made another pop up to 42. And then like it was off to the races. It just did not want to stop. The thing ran from 40 all the way up to almost $80. And it was only 10.30. 10.30 was unbelievable. And it's funny, I'm talking to Josh and I don't really like to talk about the Reddit stocks because that's not really our style. But I mean, right off the bat, I'm like, I bet the stock is on Reddit right now. I mean, there's no reason why stock that goes from $20 up to 70, which could be the next AMC. Which by the way, we'll have that to see on our watch list. You can see it broke a pretty major support levels out there. And I think maybe a lot of people were transitioning from New Egg just to get to the next best thing. But listen, this is what it is. And one of the things that we do is we just follow the money and that's what you guys got to learn here, even here on YouTube and Facebook. You got to understand how to play the game. That's what we do. You don't want to play the game, but the key is you don't kill it. Just make your days pay and that's it. Now a couple of stocks that we did trade yesterday, also I did pretty well regarding it. I think Michael just mentioned it, BTU. BTU was just unbelievable yesterday. This one also, this one was a little bit nice and a steadier move. And the only thing I wasn't not a fan of BTU is that very rarely the stock moves all day, right? So I saw the stock early this morning.  It ran from like $8 up to about $850, came back down and it probably broke this resistance levels right around $850. And you can see that's around $1030, right? And then look, it just kept going up. $11, it ran until $875, ran to $9, and this is like $11 o'clock. And then up at $1130, it's already at $940. And then you can see it just did a shake, kept going up, kept going up. All the way up to about like $130, it ran to like $1030. I mean, that was a really, that was a nice comfortable move. It had nice little shakes, but it constantly broke higher highs. And obviously when it had this big dip right here, that's where it really kind of like, where the shocker came in. But anyway, it was a nice little day on certain stocks. Not a lot of great stocks that we thought we had yesterday. We had DAR, we had JAGX, we had VXRT. Oh, VXRT actually did do very well. That was one of my long shots. I said, you know what? Stock was a long shot. And I says, I don't know about this one.  It went from like 770 all the way up to about 840. And then obviously these things just tanked. This is why, you know, listen, I don't know about you, but I am not speculative at all. I'm a very conservative trader. And you know, when I see things like this, I always think about taking the money first when it comes down to it. But anyway, let's talk about what's going on this morning. There are a few stocks out there. I don't know if anything else popped up. Norman's just calling out right now in the trading room. DB, it was a DBGI, okay.  Wow, great call. Look at that. It just started nine o'clock too. Oh my God, that's beautiful. You gotta check out, see where the orders are on that stock, DBGI, nice call. Let me go on level four and see where the orders are. DBGI, let me check that out. That one's definitely on the watch list. Okay, so I'm just loading up my data right here. Let me bring it up so you guys can see it. Yeah, you can see it's a big order right here. It looks like the guy got filled, right? It looks like he got filled right here at that 750. There really wasn't no sellers out there, you know?  There was one seller right here and he looks like he got executed. Not really seeing, yeah, there it goes. Oh, look at that, boy. Beautiful, love it, love it. Look at that, just ran to about 950. Damn, there we go. All right, way to go, nice call out there. Beautiful call, Norm. Thanks very much. So we got that one, we got the C-A-R-V. Also, not as nice as that one though. I mean, that one definitely is the nicest one out of them all. That one looks pretty good. By the way, that one's got warrants. I don't know if you guys noticed that there are warrants out there on DBGI. So we got that one too. Couple of the sleepers out there, a little bit more of a long shots. We got the A-R-P-O that I found this morning. She's up about 47%. Nice little pop, but she was up. She went up a little too much at 370. She started backing off. Looks like she's got some support levels that are holding here pretty strong on this A-R-P-O. Another one that I liked, C also came out of nowhere. C took a big hit from 2750. He went all the way down to 750. He's one of the first days that are up. So 26%. Spread is kind of ugly right now. I'm not crazy about the spread, the tier sizes that brokerage firms and ECNs are out there not buying much, but I know the stock very, very well. We've traded the stock in the past. I know the stock does move. One now also yesterday that did pretty well. It looks like she's moving again is U1. U1, we killed it on U1. You remember this in June. It went from 750, ran all the way to almost $25. It was not only a good day trade. It was a great swing trade. And we all know it was a nice little short squeeze right there, but she moved up a lot this morning around 745. She's starting to make higher lows. Not really what we want to see, but I know the stock is a fun stock to trade. We should know how to trade it because it's on your watch list. It's on your journals. So make sure you go back and review it. New egg. Guys, be very careful. There's like a big, big short squeeze. So we all know what happened with this one. The party's over with this stock right here, but she will be pretty volatile out there. Just remember, I told you this in the trading room. Just buy one share. You know what I mean? Like you can't trade on demo. Stop with the demo. Demo is a waste of time, okay? Demo is only good for to learn how the system works, all right? Which kind of brings up a funny story yesterday. I have my in-laws are staying with us. They came from Florida and my follow-up is trying to teach them how to use some of these platforms, even just on a TD Ameritrade. And I'm gonna tell you, you gotta learn how to use these platforms because you can get yourself in big trouble and you don't wanna freak out. So funny story is he was asking me, if we buy the stock now, I will open up a brokerage account with him at 10 o'clock at night. And he wanted to know if we could buy the stock now. I'm like, that, the stock market's closed, you know? So you could see how uneducated some of the people are and that's why it's so critical. You gotta know how to trade, okay? So anyway, he's got no better person to teach than me, right? So I'll take care of my follow-up. Just don't want to get him in trouble. That's the most important thing, you know, something very slow and conservative. Another stock I wanted to just bring up is AMC. So AMC is at a big support level right here. You could see it. I was nervous about yesterday when I saw the stock breaking down and the stock was at 60. You could see here, it started breaking higher. You had a big high. It's making higher lows, okay? Now it's got a big support level. If the stock breaks this support level right here at 39.70, got a big problem. It just bounced this morning. It just hit it in pre-market, came back down. If it does break it, the stock is in big, big trouble, okay? So be very, very careful for all my AMC people out there that are trading it. Now that pretty much does it. We got those stocks on the watch list. What else we got going on? I think that's about it. Just pretty much does it. Anything else I'm missing? I did not call out. We got somebody here on YouTube says, Faith Alstow, I have a question. These stocks are that popped. Do you guys enter them before they pop or you're looking for consolidation right now before? Well, listen, we start trading at 7.30, 7.45 in the morning. So if you come into my trading room, you'll see, no, a lot of us are already trading it already now and already got in before they popped. That's one of the big things. But for some of you, you got to remember, as a trader, and I'll leave you off with this and we'll move on. The goal is, they can move all day, like New Egg. I mean, like I didn't run New Egg all the way to a high. I got in like, you know, I chased it at 38. I freaked out and I got out at 42. You know, yeah, so I went all the way up to 70, big deal. But the thing is when you trade, you know, the goal is just to make your days pay. They're there every day. You can't, you know, you got to always remember in this demo, I always teach my traders. Who's a better baseball player? Mark McGuire or Joe DiMaggio? Now, I don't know if you remember Mark McGuire, even though he was a steroid freak, but he broke the world's record, the most home runs. Who do you want on your team? The guy that got on base 56 times, like Joe DiMaggio, or do you want someone to hit home runs? So my goal is, you try to hit home runs on this time, you're going to strike out more than you get on base. It's all about base hits. Remember, it's not a sprint, it's a marathon. So thanks for your question, guys. We'll be back here at 12 o'clock and also for all my golden platinum students, I'm going to do a phase three to make up what happened to me last week. All right, so at three to three or four o'clock, we're going to do an advanced class for you guys. So I'm looking forward to that, all right? See you then guys, happy trading, and we'll see you back here at 12 o'clock.


Welcome to part 2 of the lecture on intermediate code generation. So, in this part of the lecture we will continue with intermediate code generation techniques for various types of constructs in programming languages. So, to do a bit of recap last time we looked at this code generation technique for if then else statement. So, let us just go through it again. So, the production for the if then else statement can be of the form if x s going to if x s 1 semicolon n else m s 2 and then for the if then statement it is of the form s going to if x s 1 semicolon if x expands to if expression. The reason for doing this I already mentioned during semantic analysis phase and also during the last lecture we need to generate you know the the test for this expression. So, since this is an S S attributed grammar and is used with L R parsing we want to perform an action at the end of this particular handle just before the reduction by this handle happens that is the reason for breaking up this particular these productions. Then we also have a couple of markers n and m here the markers are required to generate appropriate go to statements you know at these places. For example, after the then part of the if then else statement that is s 1 is executed we are actually required to jump out of the if then else to the end of this whatever it this statement is. To do that when the marker n is used and when the reduction by n to epsilon happens a go to statement with a an unknown label target is generated. So, this particular go to statement is put on n dot next which is a list. So, at this point n dot next will contain the quadruple this you know this go to quadruple with its target unfilled m is required to remember the beginning of the code for S 2 this is required because we want to jump at if the expression is false we want to jump and execute S 2 we do not want to execute S 1 at all. So, m remembers the quadruple number of the beginning of S 2. So, that is m dot quad. So, at this point the attribute m dot quad contains the quadruple number of the beginning of the code for S 2. So, when we reduce by if e effects going to if e we generate this comparison statement if e dot result S n equal to 0 go to and we do not know the target at this point. So, we leave it as blank and this particular quadruple with its blank target is put on effects dot false list here. So, during this production the reduction by this production the effects dot false list which comes out of as a production as an attribute of effects is patched to m dot quad thereby if the result is actually false in e dot result dot S n equal to 0 is false we jump to the else part and not the then part. If the result is true then we just fall through and execute S 1 that is the idea and what is S dot next? S dot next contains all the possible jumps out of S 1. So, if there is any jump within S 1 then we need to go to the end of S 2 here after S 2. Similarly, this n dot quad must also the n dot next must also go to this point and then any other jumps out of S 2 should also go into this point. I already gave you an example of how this can happen during execution in the last lecture. So, we merge all these three lists and put it on S dot next. So, this is the way we generate code for if then else. So, let us move on and see how we can generate code for rest of the constructs. Here is a compound statement. So, there is a begin that is the parenthesis in our left flower bracket then the list of statements L and N that is the right flower bracket. So, here we just have to transfer all the unfilled jumps from L dot next to S and the A is an assignment therefore, it does not generate any jumps. So, S dot next is a N L list. For the return E that is return statement we generate the quadruple return E dot result and S dot next will be N L because the control goes out of this to the calling procedure itself. L going to L 1 semi colon M S is the production which produces a list of statements. So, obviously we need the marker M to remember the beginning of S. So, all the jumps out of L 1 are patched to M dot quad which is nothing but the beginning of S and whatever jumps remain within S or rather out of S will be put on L dot next. And the terminating production L to X simply copies S dot next into L dot next. When the procedure body ends you know there will still be some more you know jumps which are left out. So, we perform back patch S dot next comma next quad and followed by generation of the statement function N. Function N typically is returning from the procedure. So, all the left out quadruples their targets will all be patched to func N. There by there will be no unfilled targets at the end of the procedure itself. So, now let us look at a translation trace of the if then else statement. However, exactly the various back patch and gen statements are executed during the process of L R parsing and reduction. Our example is the example that we have already studied before if E 1 then there is a nested if then else if E 2 A 1 L C A 2 followed by the else part of the first if L C A 3 and here it terminates followed by A 4 which is a different statement. So, this is this entire thing is one statement and A 4 is another statement and within this statement is another if then else statement. So, we have seen this already. So, let us I will show you only a partial derivation of this. So, S derives if X S 1 semicolon N 1 else M 1 S 2. So, this is the high level if then else.   So, this is the partial derivation of our you know statement here. So, let us see how the code generation happens. First of all consider the outer if then else. So, if E 1 would reduce to if X 1 before that the code generation for E 1 would have happened then you know on reduction by if X 1 going to if E 1 we generate the code if E 1 dot result S R equal to 0 go to dash. So, at this point the just after this we have generated code for the jump by testing the expression E 1 and this quadruple address is remembered in if X 1 dot false list. So, so far we are here then the inner if then else code generation for E 2 will now happen. So, that is just before reduction to this particular handle rather if this particular non-terminal and another if then you know if E 2 dot result less than equal to 0 go to dash is generated during the reduction by if X 2 going to if E 2. So, that is what and that is remembered on if X 2 dot false list. So, we have so far finished this much. So, the code generated so far is just this code for E 1 and then a jump code for E 2 and another jump, but we still do not know the jump targets. Now, we are here so, code generation for S 2 1 happens and then we have N 2. So, N 2 by epsilon is the reduction that happens at this point and we generate a go to at this point and we remember it on N 2 dot next. Then we have M 2 dot quad which is remembered. So, that is the label say L 1 on reduction by M 2 to epsilon and then we generate the code for S 2 2 and now this entire violet part is reduced to a statement. So, on reduction by S 1 going to if X 2 S 2 1 N 2 else M 2 S 2 2 we backpatch if X 2 dot false list to L 1 that is the M dot quad. So, this entire thing you know if the expression is false we know where to go. So, we actually patch it to M 2 dot quad. So, that is this L 1. So, N 2 dot next is not yet patched because we are supposed to jump out of this. So, that is if this is this if S 2 1 is executed N 2 has generated a go to which will take you to really speaking A 4. So, we still do not know that there is A 4. So, we cannot do anything about it. It is just put on S 1 dot next which is the left hand side non-terminal here. So, so far we have generated code for S 2 2 and did some backpatching. So, because of that backpatching this target has been filled the other two are still not filled. Now, we have to take care of N 1. So, we generate a go to on reduction by N 1 to epsilon and remember it in N 1 dot next. Now, we come to M 1 and let us say that level that quadruple level is L 2. So, there is no level in practice, but it is just a number, but let us give it a level for understanding. So, this is the level which is remembered by the on reduction by M 1 to epsilon and that is remembered as M 1 dot quad. Now, we generate code for S 2 and finally, this entire thing is reduced to S. So, on reduction by S going to if X S 1 N 1 L's M 1 S 2, we can patch the false part of if X 1. So, if this if X 1 is this expression is false, then we actually have to jump to S 2. So, that is remembered by M 1 dot quad. So, that we can do at this point and N 1 dot next is still unfilled it is merged with S 1 dot next and both are put on S dot next. So, at this point S dot next contains jumps out of many points. For example, it contains jumps due to N 2 and then it will contain jumps due to N 1 and we still have not seen A 4. So, we really cannot do anything right now. So far, we have generated up to this code for S 2. So, what that means is the code for A 4. So, to do that let us look at the production which handles a list of statements. So, L going to L 1 semicolon M 3 S 4. So, at this point this L 1 is our statement actually. So, that is S 3 right this statement. So, S 3 is semicolon M 3 S 4. So, S 3 is our complete nested if then else and S 4 is A 4. So, M 3 is actually M 3 dot quad remembers the beginning of S 4. So, that is M L 3 and then the code generation for S 4 happens. Now, we reduce using this entire production L going to L 1 M 3 S 4 and we back patch all the jumps out of L 1. So, that is whatever comes out now this go to and this go to both are actually patch to A 4 which is nothing but S 4. So, now L naught lengths is empty and we because A 4 does not generate any jumps and the process of code generation is over. So, here is the final code that is generated. So, this is the trace of actions that happen during the code generation process including back patch and gen. So, let us move on let us find out how to generate code for while loops. So, we need to break up the while statement into the production for the while statement into do parts for the same reason as the if then else. So, we have while x going to while E while M E. So, M is a marker again which denotes which remembers the beginning of this expression. Why do we need this at the end of the loop we actually have to jump to the beginning of the code for E. So, that E is evaluated again and then that it is tested. So, at this point while x p dot false list is a make list next quad next quad is nothing but this particular quadruple. So, the test for E. So, the target is unfilled this is the exit for the while loop. So, we have no idea where we are we have to go this will be known only when there is a list of statements. So, while x dot begin is nothing but M dot quad. So, we remember that also as an attribute of while x here s going to while x do s 1. So, we generate we have actually finished this entire code generation or expression and s 1. So, we are here we need to go back to the beginning of the while loop. So, then go to while x dot begin will take care of that. So, remember here while x dot begin is nothing but the beginning of the expression code. Then all the jumps out of s 1 have to again take the control to the beginning of the while loop. So, back patch s 1 dot next to while x dot begin. Finally, what are the jumps out of the statement s dot next equal to while x dot false list that is the only jump out of the entire while loop. So, let us now move on try to understand code generation for function declaration and function call. So, assume that there is no nesting of functions that is the norm in C as well. So, let us take a result a function called foo its type is result it has a parameter list it has variable declarations and it has a statement list. So, this is the body of the function foo. So, the code generated for the function foo would be funk begin foo. So, this intermediate code is supposed to create the activation record reserve the space for local variables and temporaries. So, then the code for the statement list is here. Remember there is no code that is necessary for parameter list and variables it is just the space that is needed for them and the space you know offsets etcetera have already been computed. Then the function end. So, this religious the activation record and returns. So, fairly simple you know as far as the function declaration is concerned. Let us look at a function call. So, here is an assignment x equal to and then a function call bar of p 1 comma p 2 comma p 3 three parameters. So, obviously before the call is made we need to evaluate the three parameters. So, code for evaluation of p 1 p 2 and p 3 the results are in the three temporaries t 1, t 2 and t 3. Then the result of the call let us say is supposed to be returned in a temporary call t 4. Finally, we need to actually you know assign that to x. So, x equal to t 4 after the call returns we will take care of this, but there is a point that needs to be stressed here. The temporary t 4 that we are going to use to return the result is now in the callers space that is the function in which this x equal to bar p 1 p 2 p 3 is enclosed. It is not a local variable of the function bar, but it is a variable in the local space of the enclosing function for this assignment statement. So, now the parameter code is param t 1, param t 2, param t 3. These three will actually push the parameters onto the stack or the activation record. Then there is a rough param t 4 why did we really want to pass the address of t 4 and not t 4 itself. We would like to access you know this particular address of t 4 which is in this callers space within the function bar. So, if we had simply said param t 4 then you know we would have actually written the result within bar to a local variable, but here because it is a rough param the address of t 4 is passed and whenever we assign the result within bar we would use indirect addressing so that the actual you know temporary t 4 gets the value. So, including this result part t 4 there are now 4 parameters 3 explicit and 1 implicit. So, we call bar with 4 parameters so this procedure call or function call is supposed to create access links push return address and jump to the code for bar. We are going to see the details of all this in one of the future lectures on runtime environments. After the call has materialized t 4 will contain the return result. So, x equal to t 4 takes care of assigning the result to the variable x. So, now that is the code template. So, let us understand how to generate that type of code. So, again we are assuming that there is no nesting of functions. So, the function call is a very simple production function call going to id and followed by parameter list. So, let us embed 2 actions in between and expand them here. So, action 1 is the code for action 1 is search func id dot name comma found comma f n p t r. So, we are going to check and get the pointer to the function in the symbol table. So, that is returned in f n p t r.  So, at this point we know that this is the function pointer. This is required to process the parameter list and emit the code for parameters. So, here in action 2 the code for parameters has already been emitted. So, remember call name p t r is a global variable because we have no inherited variables are been inherited attributes available. So, now we need to generate a temporary for the result. What is the type of that temporary? We do not know that. So, we use the function pointer into the symbol table function name pointer into the symbol table execute a function get result type which is a compiler function which goes into the symbol table and gets the type of that function and then generate a temporary of that particular type. So, let that be result var. So, we generate ref param result var we already know why this is necessary and the machine code at the time of you know running will actually place the a in return a in the variable result var. How is this possible? This is possible because the position of the result in the parameter list is always known to the code generator and the run time system. So, the code generator knows that this will be the last in the parameter list it knows the number of parameters and it also knows the position of the result. So, it is easy for the machine code generator to generate an instruction to place this return result into the variable result var using indirect addressing remember result var has been passed as a ref param. Now, the call itself call name pointer is the pointer to the function in the symbol table and how many parameters? Param list dot p n o is the number of parameters plus 1 corresponds to the result which is an implicit parameter. So, this is the call for the function. Now, how do we compute the number of parameters? That is fairly easy. Param list going to p list you know just transfers the p list dot p n o to param list dot p n o. We need this kind of a unique production because we want to make sure that we permit 0 number of parameters as well. So, param list going to epsilon make sure that 0 number of parameters is permitted. So, param list dot p n o is 0 and p list generates one or more parameters p list going to e or p list going to p list comma e. If it is p list going to e this is the first parameter. So, we set the number to 1 and the first gen first param e result is generated. For the rest of it as and when the expressions are passed we generate p list 1 rather we generate gen param e dot result and the number of parameters is counted and incremented. So, p list 2 dot p n o plus 1 is assigned to p list 1 dot p n o. So, this is how p list accumulates the number of parameters and passes it on to param list and that is used in this production to generate the appropriate call with the number of parameters. So, what about declaration? Fairly easy. Function declaration is function head followed by wire declaration body. So, at this point we generate the gen funk end. So, because we have passed this entire right hand side and what about body dot next? So, as I already showed you body dot next corresponds to all the jumps out of the loops etcetera within this body and the last part of the body and that is passed to the function end. So, that there are no more hanging gotoes. Function head goes to result id followed by declaration p list. So, now we search for id dot name find it in the symbol table and it is pointer is name p t r and active funk p t r would be. So, this is the function name. So, that would be name p t r. We are now looking at the body of the function. So, the pointer is active funk p t r. Now, generate funk begin active funk p t r. So, the code generation for function declarations is quite straight forward. Let us now understand how to generate code for various types of assignment statements. So, before that we must understand the representation for multi dimensional arrays because we will use multi dimensional arrays in assignments and other expressions. So, if there is a three dimensional array we can look at it in three dimensions as slices. So, these are the various slices and each slice consists of squares. So, each square is an element. So, this is the 2 d array and this is the third dimension of the array. So, this is the i part, this is the j part and this is the k part. So, when we represent a three dimensional array in memory. Obviously, memories are single dimensional. So, we must map the 3 d array to a 1 d representation. How is that done? For the 3 d array that we have. So, these are the slices. So, i equal to 0, i equal to 1, i equal to 2, etcetera, etcetera. So, this is i equal to 0 and this entire thing is i equal to 1. Similarly, we will have i equal to 2, etcetera. In one of the slices, so say this is the second slice. So, we have i equal to 1, we have j equal to 0, j equal to 1, j equal to 2, 3, etcetera. So, this is j equal to 0 and this is j equal to 1. So, let us say there are only 2 possible indices here. So, within this slice and the part corresponding to j equal to 1. So, i equal to 1 and j equal to 1. So, this is the third element 0, 1, 2, 3. So, k equal to 3. So, whenever we say a of 1, 1, 3, we must map it to this element in the entire single dimensional array representation. So, that offset is computed as i star n 2, n 2 is the size of the second dimension, number of elements in the second dimension. So, this is the slice number. Then n 2 corresponds to this, you know, 2 d array size. Each one of the elements of the slice contains as many elements in this as in this 2 d array. So, that is why i begins with a 0 here, we are considering c like representation, c like programming language. So, i starts with a 0, that is why it is i star n 2. So, if we have i equal to 0, then this becomes 0. Obviously, with i equal to 1, we need to skip this i equal to 0. So, that is why when i equal to 1, we need to skip n 2 elements. So, we have skipped here and come to this point, skip this entire slice and come up to this point for i equal to 1. Then we add j to it. So, let us say we are looking at this element. So, we have, we now want i equal to 1, j equal to 1, k equal to 3. So, we add j to it. So, that is plus 1 and then multiply the whole thing by n 3, that is because we need to skip so many elements, you know, within the j. So, j is 0 here, j equal to 1 here. So, we need to skip this entire j equal to 0 and come to this part of the slice rather the 2D array. So, that is done by star n 3. So, star n 3 says, you know, this is j. So, this is the row number. So, how many elements are there in each row? That is n 3. Now, plus k means the number of elements that we have skipped here. So, 0, 1, 2 and then k equal to 3. So, we come to this point by adding k. All this has to be multiplied by the number of bytes that each element of the array, so that is this element takes. So, that is why we multiply it by the element size. So, that will bring us to the beginning of this element and then we can do what we want with it. So, let us see the code generation template for this. Consider a declaration A 10, 20, 35 and then another simple variable B. A is an array, B is a simple variable. For the simple assignment B equal to x 1, where x 1 is an arithmetic expression, the template is code for evaluation of x 1 result in t 1 and then the quad B equal to t 1 fairly simple. But, suppose the assignment statement is complicated A of x 2, x 3, x 4. So, this is the element of A to which we want to assign x 5. So, I have mentioned the offset part again here, so that we can understand how the code is computed or as what is generated. So, x 2 is evaluated first result in t 2, x 3 is evaluated next result in t 3. So, now we do t 2 star 20 which is nothing but the n 2 part second dimension 20. Then we add the j that is x 3, now we generate code for x 4, then you know this t 5 is multiplied by n 3 that is 35. We add the k part that is t 6 here x 3 or rather x 4. Now, the each element is an int here, so element size is int size, so t 8 into int size is t 9. Now, t 10 we get address A, we generate code for x 5 in t 11 and now finally, we can say t 10, t 9 is t 11. So, t 10 is the base address of the array, t 9 is the offset that we have computed byte level and t 11 is the expression on the right hand side. So, this is the type of code that gets generated for arrays. So, let us see the S attributed grammar for assignments and expressions and understand how the code gets generated during L R parsing. This is a set E G again, so we have the assignment statement S going to L equal to E. Now, L is the left hand side, it could be an array element, it could be a simple variable. So, if it is a an array element, then we need the base address and the offset and if it is a simple variable, we just need the address of that variable. So, L requires two attributes, one is L dot place pointing to the name of the variable or the temporary in the symbol table. So, this could be the array base address or array name or the simple variable name and L dot offset is the offset in the case of an array. So, if it is a simple variable then it is null. So, we check whether the variable is simple or array. So, if L dot offset equal to null then it is a simple variable. So, we simply generate L dot place equal to E dot result. So, this is the assignment which is generated. So, I already showed you that here, so this is simple variable. So, L will have only the address of B and nothing else. So, if it is an array variable then we need to generate L dot place brackets L dot offset equal to E dot result. So, this is the indexed instruction that needs to be generated. So, this is what we generated here you know this particular instruction. Then parent size expression is there is only a transfer of the attribute and E going to L. So, this E is on the right side. So, remember that this can also be either a simple variable or an array expression again we need to distinguish between these two. So, if L dot offset is null then E dot result is L dot place. So, simple straight forward if it is not null then the right hand side is an array expression. So, the point is a single quadruple cannot have array expression on the left hand side and array expression on the right hand side high level language statements can. So, I can write A of B equal to C of D in the high level language statement, but in the quadruple level there can be an array axis or indexed instruction only on the left side or on the right side one at a time. So, we know that it is an array and we know that this is the right hand side. So, we generate a temporary E dot result equal to new temp L dot type. So, that is the type of L and generate E dot result equal to L dot place bracket L dot offset. So, an indexed instruction is generated and it is a you know and that will be in E dot result. So, the value will be in E dot result. So, this is how we take care of assignments from an array and here we take care of assignments into an array. What remains is computation of the mapping from 3D array to R 4D array to single dimensional array, we will see that very soon. If E is a number we just generate E dot result equal to num dot value. So, E dot result is a temporary of the type num dot type addition. So, E going to E 1 plus E 2, not so trivial because here the types of E 1 and E 2 will drive the code generation process. So, if E 1 and E 2 are of the same type and then there is no problem you know we do not need any type conversion. If E 1 and E 2 are of different types then we actually have to do a type conversion. So, for example, result type is compatible type E 1 dot type comma E 2 dot type. So, if E 1 dot type is real and E 2 dot type is also real absolutely no problem then result type will be real. Similarly, if both are integers this will be integer, if one is integer and other one is real then result type will always be real. So, this is how compatible type checks all this we have seen this during semantic analysis. So, we require this to generate the temporary for E dot result, new temp result type. Now, generating code for type conversion is done here. So, if E 1 dot type is result type then there is no type conversion necessary opera and one equal to E dot result. So, we just transfer the address and if E 1 dot type is integer and result dot type is real. So, that means we must generate code for type conversion. So, we generate a temporary opera and one equal to new temp real and generate instruction opera and one equal to convert float E 1 dot result. So, remember E 1 dot result is integer type. So, we are converting it into real type and assigning it into the temporary opera and one. So, this is the instruction that is generated for the type conversion exactly the same thing happens for E 2 as well. So, if there is no type conversion opera and 2 retains the address of E 2 dot result, if there is a need for type conversion then we generate a temporary and you know generate the instruction opera and 2 equal to convert float E 2 dot result. So, now at the end of this exercise opera and one holds the address of the first opera and opera and two holds the address of the second opera and with or without type conversion. Now, we are ready to generate the plus operation E dot result equal to opera and one plus opera and two. So, this is the instruction for E 1 plus E 2. If there was no problem and all types were just integer then all this checking was not necessary type conversion was not necessary. We would have generated a simple instruction E dot result equal to E 1 dot result plus E 2 dot result. So, that is not possible anymore because of many types which are permitted in expressions. Exactly the same thing happens for the logical operation or E dot result we generate a new temporary and we generate E dot result equal to E 1 dot result or E 2 dot result. I am skipping some of the details like type conversion here because even here character or integer both are permitted in C. So, some simple type conversion may be necessary even for this and it is on the same lines as the E 1 plus E 2. So, I will skip that and leave it for exercises E going to even less than E 2. So, there is a relational operation here. So, even less than E 2 will generate either a 1 or a 0 depending on the conclusion. So, if even is definitely less than E 2 then the result is true. So, we generate a 1 if even is not less than E 2 then we generate a 0 and that value is put in E dot result. So, E dot result gets an integer temporary the address is stored in E dot result. First we initialize it to 1. So, generate instruction E dot result equal to 1. Then we generate the comparison instruction if even dot result less than E 2 dot result go to next squared plus 2. So, that is the result is true. So, this is next squared. So, if E 1 dot result less than E 2 dot result is actually next squared. So, this is the number next squared in the quadruple array this is next squared plus 1 and after this that is after the expression E is next squared plus 2. So, that is where we need to jump and continue from that point onwards. So, if this is true then we do not reset the result to 0 we keep it as 1 and then go further. If the result is false then we make the result 0 and then continue with the operation. So, that is how it would be. So, if the left hand side L is just a name then search for the name. So, the name could be either a variable or a parameter. So, we search the symbol table and get its pointer. So, L dot place becomes V n and L dot offset becomes null because this is a simple variable. Now, we come to the important part of expressions array expressions. So, again we have broken the productions into parts as in the case of semantic analysis. So, E is going to I D bracket E. So, this is the first expression search for the expression find its pointer. Now, the dimension number is 1 because this is the first expression the E list dot array pointer is V n. So, that is the pointer to the name of the array in the symbol table. So, that is the entry and E list dot result will be E dot result. So, that is the first subscript of the array expression the rest of the subscripts are generated by this production and finally, the expression is closed using this production. So, let us look at this first the E list has generated all the expressions and so I D bracket E is also E list. So, first expression is generated then the second third etcetera are all generated here finally, the bracket closes the subscript expression list. So, once all the subscripts are generated L dot place is still E list dot array pointer. So, that is the base address part of L then temp equal to new temp int. So, we generate a new temporary and offset will be actually nothing but that new temporary. We are going to generate instructions to collect the offset into the temporary. Size of the element is obtained through the symbol table pointer. So, E list dot array pointer point to E list E list size. So, this will give us the element size from the symbol table. Now, we generate the instruction temp equal to E list dot result. So, that is the function of all the parameters subscripts here star E list size. So, we have done the nested evaluation finally, what remains is to multiply by the size of the element like int or float. So, that is done here after E list dot result accumulates the entire expression value. So, now at the end of this we L dot place and L dot offset will contain the appropriate pointers into the symbol table and the code for evaluation of the entire subscript list has been generated. So, here is the subscript list generated. So, this is the first part of the subscript list and this is the next last one. So, if there are three subscripts first one is generated here then you know E list 1 comma E. So, this is the second one and then the third one and so on and so forth using this we can generate as many as we really want. So, if we do this three or two times we generate E list 1 comma E and E list 1 comma E again. So, and finally, E list going to I D expression generates the first one. So, this is the first one and then the second one and third one can be generated using these productions again and again. Number of dimensions E list dot dime is this plus 1. So, this is the next dimension. So, that we did array pointer is just transferred you know from here. So, we found it we got that here right. So, we are going to transfer it to E list dot array pointer. Number of elements we look at the symbol table using the array pointer and then the number of dimensions or number of elements in this dimension for this subscript will be E list 1 dot dime plus 1 right. So, this is the dimension number of this. So, we search the symbol table and get the number of elements corresponding to that particular dimension that is this E. Now, generate temporaries to do partial evaluation temp 1 and temp 2 both are in type because subscripts are always integer expressions. Temp 1 multiplies. So, E list 1 dot result star num alum. So, the number of elements in this dimension is multiplied with E list 1 dot result. So, that is I star into plus j whole thing star n 3. So, that is the you know nested evaluation that we are doing here. Then we add temp 2 equal to generate temp 2 equal to temp 1 plus E dot result. So, this is this does I star into then plus j that is what we are doing. So, if we repeat this using the same production again and again we can generate the instructions for the entire subscript list. So, now we have completed code generation for expressions assuming that there is nothing called short circuit evaluation. So, let us understand what exactly is short circuit evaluation for Boolean expressions. So, expression 1 and expression 2 suppose we want to evaluate this the straight forward method would be evaluate expression 1 completely then evaluate expression 2 completely and generate an and instruction for the 2. So, that is what we are doing here right. So, instead of this or we can have and here. So, you would generate even dot result and E 2 dot result, but there is another way of generating the result. So, its value is if expression 1 is false then the entire expression is false that is true because if this is and operation. So, if this is false then the entire expression 1 is false. So, if the expression 1 is true then you know we must evaluate expression 2. Otherwise we would not know how exactly what exactly the value would be. So, the value would be x 2 itself whether it is true or false whatever that is. So, this implies that x 2 need not be evaluated if expression 1 is false. So, in other words we are short circuiting expression 2 that is why this is called short circuit evaluation. The same thing holds for r as well in, but it is exactly the converse. In the case of and if this was false the expression would have been false in the case of r if this is true x 1 is true the entire expression is true. So, if x 1 is true we can short circuit evaluate x 2 because it is not necessary to evaluate it anymore, but if expression 1 is false then we must evaluate expression 2 as well. So, the value is if x 1 then true else x 2. So, that is the way short circuit evaluation is done expression 2 is not evaluated if expression 1 is true. So, Boolean expressions are commonly used conditional loop statements and if we use short circuit evaluation it is possible to realize this short circuit evaluation of expressions using control flow constructs I will show you how that can be done. So, in other words in such cases there are no explicit r and and operators in the intermediate code as we saw earlier, but there are going to be only extra jump statements. This is much faster because complete expression is not evaluated at all and if un-evaluated expressions have side effects. For example, if expression 2 has a function which alters a global variable or prints out something into a file etcetera then it will never be done if expression 1 is true because we are going to short circuit expression 2. So, in such cases the program may have non-deterministic behavior because the once first time possibly expression is true and this entire thing is skipped, but next time possibly expression 1 is false. So, expression 2 will also be evaluated and at that time the printing will happen. So, the person who is running the program will see that printing happens sometime and printing does not happen some other time. So, this is non-deterministic behavior. Let me show you a template or rather an example of how it can be done and then we will see how to generate code. So, the expression is if a plus b less than c plus d or this entire thing then a 1 else a 2 followed by the treatment a 3 irrespective of what happens here. So, we evaluate a plus b and c plus d if t 1 is less than t 2. So, we are evaluating this now go to l 1. So, if this is true then the entire thing can be skipped.  So, this is short circuit we have short circuit at this entire expression.  Second expression has and here. So, if e equal to f go to l 3. So, that then we must evaluate this expression if e equal to f is false then you know we do not have to evaluate this entire expression at all. So, that means we go to l 4 which is code for a 2. So, that is the else part of it.  So, that is the code for a 2 finally code for a 3 will be executed in all the cases. So, this is how short circuit expression really happens in the case of if the nulls. We will stop here and we will continue with code generation scheme for such expressions in the next part of the lecture. Thank you.


We demystify what goes on behind the therapy room door. Join us on this voyage of discovery and co-creative conversations. This is The Therapy Show, behind closed doors podcast, with Bob Cook and Jackie Jones. Welcome to Episode 110 of The Therapy Show, behind closed doors with myself, Jackie Jones, and the wonderful Mr Bob Cook. Yeah, I do need to find a new way of introducing you. And what we're going to be talking about in this episode is how to use touch in the therapy process. Yeah, it's a great touch, but I was just laughing because our fair, we talk about the use of touch in psychotherapy, you said without being arrested. Yes, how to not get arrested. It's a bit like that, in a way, because with the sort of increase, how can I explain this? People's fear of litigation, which I think leads to what are called defensive psychotherapy. People are very, and certainly beginning psychotherapists, are particularly sort of apprehensive about this whole subject of touch in psychotherapy. I mean, I think it's a very big area, and specifically for, as I said, from beginning psychotherapy, and also even sort of experienced practitioners sort of start to think, what should I do? Somebody asked, one of my clients asked me for a hug or if I decide to touch them in some ways. Where does that leave me? So even experienced psychotherapist, I think, may be apprehensive around touching psychotherapy. Absolutely, absolutely. There's a lot written about it. It's a controversial subject. Which is a shame because it is a form of connection when we touch another human being. It is a form of connection and empathy and relationships and all that sort of stuff. That's right, and I think we need to be clear about what you mean by therapy, because there's different types of therapy. There's body therapy, for example. There's all the spiritual therapies. There's cognitive therapy. There's emotional therapy, if you want to put it that way, and I can think of many therapies which seek your expression of emotion. So I think we need to be clear what we mean by therapy. And then a good way to look at this, I think, is look at the phase psychological contact. Because I think there's many articles written about what is psychological contact, as well as what is physical contact. And then in the therapeutic domain, it's important to think of, I think of it this way, that it's not just going to be at the non-verbal level. It's really important that you contract for any physical touch in therapy. That's the first tip I can give anybody, beginning or experience psychotherapists, that if you're going to make any physical contact, which you might argue as a psychological function, you need to get consent first. You need to ask and say, you won't need to ask about it. So if you're going to decide that you can't need a hug, for example, in terms of whatever treatment you're doing, then you need to ask them first, is that okay? You don't just go and hug them because you think they need a hug. Once you do that, several things happen. Your assumption might be totally incorrect. They might not need a hug, for example. You're also taking away the whole concept of self-agency once you start assuming and taking things into your own hand. There has to be a bilateral contract, I believe, for touch. Now, listeners here might disagree with me, but I think it's very, very important that that happens. When you're saying that, do you mean at the beginning of therapy, like in the written contract? No. You mean in the session before you write? Yeah. You might put it in the written contract. That's not a problem, is it? Of course. I've not put it in my written contract, but I would always verbally contract with them. Yeah. Yeah. Whenever you're going to physically touch somebody, and it's very important to ask their permission, if you want to put it that way, or their consent, because you leave yourself open to a whole minefield if you don't. Yeah. And I can't see any reason why any... I can't see any reason why any therapist wouldn't ask for consent and talk about this post-it in psychotherapy. No. I wouldn't. I suppose it depends on deceiting arrangements, whether it's kind of like the only way I can think it might happen without contract is if it was just an instinctive gesture. But I sit on a chair, and my clients sit on a couch opposite me, so I would have to physically get up and move towards them. So it's not something I would do unconsciously or out of my awareness, if that makes sense. Yeah. And I think it's very, very important that a therapist doesn't know what to do. So, for example, say they think there's a relational need for initiation to be met. I was thinking of clients who might be in their history had emotional physical neglect. Yeah. So the therapist might be thinking, oh, this person needs a hug, or if there's emotional expression, and they're crying, or whatever it is. I suggest, anyway, that of course, that the therapist does not take that assumption on their own bat. They ask the client first. You know, it's very easy to do it. Not only do they verbally do that, but they need to have a clinical thought process behind the initiation of contact, and not just out of some sort of spontaneous whim or some instinct. That's the clinical thought. Yeah, absolutely. Because I know for me, it can be quite, not so much now, but in the early days, it can be quite uncomfortable to witness outward emotion in a therapy room without feeling like you need to do something to kind of stop it or prevent it or make them feel better. But that isn't necessarily part of the therapeutic process. No, certainly isn't because a person or the client might need to express their emotion. And in fact, the hug, if the therapist desires, you know, even asked the client for a hug, may be counterproductive to the treatment and may close down on emotion in terms of soothing them when actually they need to get the emotions out. Yeah. So sometimes it is just sitting there and, you know, sitting in the space. One of the things that I do do is ask them if they need anything from me right now, rather than actually saying, do you need a hug? I'll say, is there anything that you need from me right now?  But I don't tend to presume that they need anything. I think it's very important to have a contract, a moment-to-moment contract. Yeah. You think you are going to hug them without asking them? You have to ask yourself, play sprongly, the clinical reason for that. Yeah. Things do come up for me in therapy, not necessarily in the moment when it's needed, but I will say to the client, you know, things like, how will I know if you get angry at me in a session? So I'm, you're kind of aware of certain emotions that might come out. And, you know, if you do get upset in a session, is there anything that you'd like me to do at that point? So I've kind of, we've spoke about it. That's great. As a transaction analyst, I'd like to encourage the people who listen to this podcast or watching it on YouTube to think about what ego state the person is in, or coming from when you think they need a hug, or even when you think of asking the person, is it okay to have a hug? That's really important, because if you think about it this way, if you're working with regression developmentally, then, you know, if you think about this in terms of childhood ego state, the person could be seven, could be 10, could be three, most likely they'll go to the level of trauma, but you are going to be then in the land of a younger person. And, you know, physical contact might be very necessary in the, in way you started right at the beginning in terms of external communication, the deliver of empathy, the soothing, the nurturing other. I can think of many reasons why touch might be necessary in the healing process, and you need to ask them first, and also remember to think about it clinically, because they could also simply adapt to you. Yeah. Yeah. In particular, like you say, whatever ego state they're coming from, if they're coming from the adaptive child ego state, or yeah. And so if they are, if you are thinking they're adapting, you need to ask it again, see if you can get it from the adult ego state, the transaction back again, rather than taking an adaptive transaction. Yeah.  So if the young child in terms of the developmental aggressive position I'm talking about thinks they have to please you for strokes, and you're not getting an adult contract at all. No, absolutely. Yeah. And, you know, following on from that, this kind of like the, I'm okay, you're okay in the adult transaction, which is what you're saying rather than, you know, I'm okay, you're not okay. As much as you can, you need to contract the touch from the adult ego state. Now I understand in aggressive developmental work, the person might have gone to a younger place by spontaneously. So it may not be so easy to get an adult contract. But as much as you can, I think it's important that you do. Yeah. And it's, I always, I know it's, it might sound a bit, you know, heavy or not but I kind of always debrief afterwards. If ever I have, you know, we have touched that clients asked me for a hug specifically in a session when they were getting, I think they were feeling overly anxious and that she said, you know, can I have a hug please. So I did, I went and sat by and I gave her a hug, but we had a debrief after about how they felt rather than not talking about it after the fact. I think that can be quite therapeutic. You know, why did you feel the need to ask me for a hug and, you know, just, yeah, talk about it. Because potentially they could get a backlash when they're outside the therapy room. Absolutely. I think it's a very good professional stance that you take there, definitely. And I'll repeat again as well that though I see the many, many, many benefits of psychological contact through touch, for example, and all the ways you said, there is another way of looking at this and I'm repeating what I said five minutes ago, but I think it's important that touch may also close someone down. That probably might be strange for the podcast listeners to hear. But I think it's true. Yeah. Because the client may, it's in psychoanalytical terms, so it's an unconscious process and may manipulate you to give them a hug or soothe them so they don't go to where they need to go to. Yeah. Does that make sense? It does. It does. Absolutely. But it's how you would know that that's what they were doing. That's maybe what the confused look is for. I think it's going back about 20 transactions, Jackie, we were just talking about. The therapists are trained to look for adaptations and you know, it's try hard. You know, the drivers are all talking about maybe many of the podcast listeners coming from different modalities are trained also to look for the defense systems around adaptation as well. So I don't want to discount that. However, clinically, you need to think about is this person adapting to me here? Yeah. It's a very important question. So one of the reasons you'll know is if you feel that they're not being genuine, if you think they're over adapting to you, if you think that they're trying to manipulate in some ways to get some touch or hugs to not develop their own sense of expression of emotion or go to where they need to go to. I know it's a clinical judgment, but you should be thinking clinically all the time anyway. You could even ask the person if you felt in some ways there was a lack of authenticity or a defense system or adaptation, you could ask them, oh yeah, you know, I'd really like to give you a hug and I was wondering which ego state this request has come from or I was wondering what would happen if I didn't? Now, people again listening to this may want to have different thoughts on this process, but they are clinical options you can take without rushing in willy-nilly. Yeah, absolutely. And I do agree, I think it can be a way of avoiding certain things. Oh, well without doubt, without doubt. Yeah, I think, you know, hopefully the listeners might even notice that in, you know, not necessarily in a therapeutic relationship but in our own personal relationships that sometimes we can use, you know, touch and hugs and affections as a way of diverting from something. Absolutely. I'll tell you what it could be. It could be the encouragement of self-agency, the process where they move away from taking action. There's many reasons they may encourage that process to have touch, which actually shuts them down. This will all be done unconsciously, shuts them down. Yeah. Making action, for example. Yeah. Having said all that, I don't want people to listen to this to think that I'm not in favour in terms of relational work to look for relational needs. And for people who have had particular trauma or people who have had quite a lot of neglect in the history, I think touch can be extraordinarily important, but it needs to be done with a contract. Yeah. Touch can be really powerful if it's used appropriately and at the right time in, you know, in a therapy process. Definitely. Yeah. And most of the body therapists are therapists that come from the belief systems of embodied trauma. Well, I would imagine and hopefully have an adult contract for touch because often the trauma is held in the body. I was thinking of massage therapists here, particularly knowledge. I had a massage the other day and I didn't know the person particularly, but we were talking afterwards about the person's training. And I said, well, I think all massage people's training massage actually should have some training in counselling skills or understanding the whole process of trauma being held in the body because, you know, clients can go to particularly or be triggered back to particularly sensitive times and the massage person might even be unaware of that and not know what to do. Yeah. Absolutely. Yeah. There's a book in there. The body holds the score. Is it? Yeah. Yeah. Yeah. Talks all about body and body therapy and a lot of the trauma is held in the school. The body knows the score, I think the trauma is held in the body. So that's a plea for massage therapists to think about things in this way. And of course, you know, as I said earlier on, you know, body therapists, massage therapists, they all use touch and touch is really, really one of the quickest ways to get through people's defence systems. Yeah. Now, there has to be a contract that way. Other ways you could, and that's a strong word, I'm using it tentatively. If you don't get a contract, I think you could be in the world of abusing them. I was going to say, there's a very fine line, isn't there? There's a grey area there about, you know, whether you cross the line or not. That's very important. You know, another really big area to think about. And I think therapists are trained in this and are thinking more about this every day. It's a very common word now used a lot in training. And that's the area of neurodiversity. Yeah. Because with the neurodiverse clients, particularly I was thinking of people high on the Asperger's process or high on autism, or they certainly would feel very overwhelmed, I think, if the therapist decides to suddenly touch them. Yeah. They feel very overwhelmed and want to shrink back. Yeah. So we have to think about neurodiversity when we're thinking about touch, I think. Yeah. Because, you know, if they are on the spectrum, the spectrum is quite a wide ranging one. So we might not always have an awareness of that, you know, especially in the early days of seeing a client. Yeah. And I was, in fact, I don't see clients now, I was talking to a therapist about this, and they've gone on some training and they talked about the use of touch with neurodiverse people. And there was somebody in the room who was very high on the Asperger's scale and felt, what's the word? I want a slight better word than abuse, but certainly invaded. Yeah. The therapist helped them with that concept. Yeah. And I can see, I can see that, you know, yeah, definitely. I thought, I think it's really important, debriefs as well, what you said earlier on. I think that's a very good practice as a psychotherapist. If you're going to do any of this developmental work, even though you might have a contract, and even though it might be important for touch around the healing of trauma, I think it's important that's talked about. Yeah. What happened is that the client will probably move developmentally to a different eager state, an adult eager state. And in the debrief, you can talk about this and talk about treatment process in it. And the reason about what we're talking about here now. Yeah. Yeah, absolutely. Because it's about them being in an okay place when they leave the therapy room, that there isn't any shame or guilt or embarrassment or anything like that, which to prefer, even if there isn't any touch involved, if a client does get emotional, I usually do that before they leave anywhere. And there's a rise of what I would call cognitive therapy at the moment in 2023. You've got the NHS, which CBT is the favoured modality, cognition and behaviour has been the major method for cure. So there is a rise of cognitive therapies and behavioural therapies, who from that position, they would see cognition and behavioural processes as the way for cure and no need for touch at all. Now, we could call, by the way, looking at cognitive distortions and some of the behavioural tasks I'm talking about, psychological contact, through transactions, for example. But they wouldn't be taught about, I'm going to see the need, I think, for touch. Yeah. Now, the Gersholt Therapist or the EFT Therapist or the Developmental Regressive Therapist or some of the Integrative Therapists, they would think about the healing being in the past, not the present. So it would work regressively or developmentally where the trauma is and would certainly argue for the need for touch, as being a healing process with the traumatised child. Yeah. It's interesting because they are quite in therapy that we do. It's really emotive when people are touching the horse or when the horse makes a move towards them and the horse touches them. It physically brings up emotion for people. So touch is really powerful. It is immensely powerful and usually with a neglected child or a traumatised child, sorry, touch is an important process to utilise. So I think we know that and EQUI therapy I don't know much about, but I really understand that. I do have two dogs and one of the dogs would be a wonderful for a therapy dog. Yeah. And I think there's so much in touch here. Another thing I just want to say before we finish on the podcast here, and that is that we're talking about adult psychotherapy here. You do not touch, that's put in another way. Therapists who work with children below the age of 18 do not touch. No. Regardless. Yeah. They're sort of local parents if you like. And it's a very important tip for anybody listening. However you think the child might need a hug or pat on the back or whatever it is. Contract or no contract, you don't do it. Absolutely. 100% agree. Yeah. It's a very difficult situation. Having been a foster carer, we were always told that we would never be in a room with a looked after child with the door closed. You know what I mean? Obviously, I'm not talking about bedrooms and things like that. They could close the bedroom doors, but you know what I mean? We would never shut the living room door if I was on my own in the room with one of the looked after children. But confidentiality wise, you need to close the door in a therapy room. So you do need to protect yourself from anything in that room, really. Yeah. Yeah. Any interpretation. Exactly. Yeah. Finding truth. I mean, you worked with children in this whole area, so you must be very clear here. Yeah. Absolutely. Yeah.  Absolutely. You've got it many times, unfortunately. Yeah. So that's sort of one thing I want to say because we've been talking about adult psychotherapy and there's many, many therapists who work with children and adolescents where it touches, we just don't do it. Yeah. Yeah. You need to protect yourself. You need to protect yourself as far as the adults are concerned, but even more so, where children are concerned. Yeah. I sort of wanted to say that for people listening and might be working with children adolescents. Yeah. It's a very controversial area this in terms of adult psychotherapy, I think, is a lot written about use of touch, not touch, but for the very beginning psychotherapists, I think the most important thing is if you think, oh, should I touch the client, should I not touch the client?  One, the clinical reason why you think that person might need a hug. And secondly, perhaps the most important, they'd be decided to go ahead with it. You ask them first. Yeah. And the third, and this is vitally important, and we've said many, many times in this podcast, you need to take that clinical intervention and what happens next to supervision and to discuss the reasons why you decided to ask the client, is it okay if I hug you or whatever you did? Yeah. And you need to discuss the response back again. And what was the clinical thinking about initiating touch in the process? Yeah. So contracts, clinical thought, and the use of supervision is vital when you want to bring touch into the therapy process. Yeah. I'm somebody who spent years working developmentally and aggressively and have used touch many, many times from clinical reasons and I could talk about here. I've taken this to supervision many times, but I have always, I think, well, I don't know, I've been going a long time, got consent first with the client. Yeah. The other thing, I wish we'd have had a second podcast is nice, Jackie, but the other thing we could talk a lot about it, we've got a couple of ways to talk about it. And that is, when you ask the client, here's the kind of scenario for you. So the client's getting distressed. And so you think, oh, well, the client perhaps needs a hug here. So you ask them and I say yes, then they give you a hug. And you think everything's okay.  And what you've forgotten in our process, or hopefully I've made this up so it wouldn't happen, is that the person's got a history of sexual abuse.  The hug may not be a hug. Yeah, I'd be a hug from you. But for the person on the other side of it, it can easily turn into, transferentially, the hug from the abuser. Yeah. Yeah, yeah, you do need to be very, very careful about, like you say, you know, even if you verbally contract and they say yes, it's what happens after that. Yeah, that it might bring up something for them. That's, yeah. Especially if people have been used inappropriately. They've been sexually abused. They have a history of sexualized and apropanous. In the transference, they can make you easily, they may not start out this way, into the abuser for my history in terms of projection. Yeah. Yeah, so it's not something to do lightly in a session. Especially again, if you work in the world of transfers, then you may think X. Yeah. In the transferential process, and you may never know this, you don't, you become someone else. And that's someone else might have been their abuser from their own history. Yeah. Now, then transfers gets all mixed up.  And therapy goes nowhere. Yeah. Yeah, it's kind of like, you know, like you say, it'll be a trust that's broken transferentially. That's what it'll feel like that something's changed in the relationship, definitely. Yeah. Yeah, I like, it's not something that I think there's only two occasions and on both occasions, I've been asked by the clients to give them a hug. Yeah, I do tend to use my body language and lean forward and, you know, to me, drop the tone of my voice and nurture them in that way. But it's not something that I would feel comfortable doing. No, what you're talking about there is you're transacting psychological contact by, you know, in that way. So, but once we get into this process of transferential worlds, yeah, working with aggressively, psychodynamically, developmentally, often, you know, you aren't who you think the client thinks you are. In other words, they often project to you the negative object into you and you may not even know about it and you end up repeating history. Yeah, which happens in therapy anyway, but if you put touch into the mix with somebody that's been abused, it's, yeah, it's a big deal. Okay, so the three tips. One is you make sure you have consent for your client. Secondly, you are aware of transference, like I've just said. Thirdly, that you take this to supervision. Yeah. Fourthly, you think about step back and think about this clinically. What is the reason I'm doing this for or offered this for? Yeah, and maybe having my ex foster carer head on making sure that you make a note of it in your notes potentially, if you do keep notes that, you know, on this occasion, what happened just so that you've got a term of reference for it. Yeah, because I've known where I've known things go dreadfully wrong, not just for the client in terms of whether there's been a repeating of history and, you know, therapy's gone, not the direction, not a healthy direction, but also for the therapist where they've been accused of something being sexually inappropriate or whatever we want to say here. And they know that wasn't their intention at all. Yeah, absolutely. Yeah. After projection and projective identification, the therapist can find herself suddenly in a transferential nightmare. Yeah. So not wanting to skirt the living daylights out of any therapist out there, but, you know, my advice would always be cover your back. That's what I always used to say as a foster carer. To think about it clinically, use supervision and ask the client. They're three golden rules. But also, yeah, well, those are the three golden rules. I use them all the time. And I'd really like what you said, which is debrief from an adult position. If you do go down that road at all. Yeah. Absolutely. So next time, Bob, I think it'll kind of follow on quite well from this. We're going to be talking about therapy by Roth, the inexperienced therapist. Oh, yes, that's a, I can't quite go back 40 years, but I certainly took a long time, I think, to move away from, you know, take things by wrote in the therapy process. So yeah. Okay, talk until next time, Bob. Thank you very much. You're welcome. Bye. You've been listening to The Therapy Show behind closed doors podcast. We hope you enjoyed the show. Don't forget to subscribe and leave us a review. We'll be back next week with another episode.


Assalamualaikum my dear brothers and sisters, Happy Ramadan to all of you. I hope you're all doing fine and fasting with the grace of Allah SWT. Welcome to Aliyah's kitchen. We are starting weekly Ramadan series from now on which are very easy, quick and you can make these with very few ingredients. As you know we all are locked down and fasting Alhamdulillah and don't want to spend much time in the kitchen. So here we are. I hope you will like these recipes InshaAllah.  So let's start our ingredients now. So Bismillahirrahmanirrahim. We are taking half kg boneless chicken. We are taking half cup of heavy whipping cream, half cup of oil, one green chili cut into slice for just for garnishing. We are just taking one small size onions cut into slices, one cup yogurt. I took 18 almonds soaked in water, soaked in half cup of water for 15 minutes and then I boiled it in microwave for a minute and then just peel it. We just boil it just for it is easy to peel. One tablespoon ginger paste, one tablespoon garlic paste. I'm taking seven to eight curry leaves, one tablespoon chili flakes, one tablespoon white cumin seeds, three cardamom and one tablespoon salt. Salt and these chili flakes are according to your own taste. So these are the ingredients. So let's start our cooking now. Bismillahirrahmanirrahim. Our first step is five onions. So we are adding oil in that there was half cup. And now we are adding these sliced onions which was one small onions. I hope you will like this recipe and this recipe is very simple. If you have fried onions at your home, you can use that one. It would be more quicker but I am just telling you step by step. So just fry it. Don't over fry it when it will get a little bit light brown color. So we will take it out because we need aroma of the frying onions in the oil. So now we will take it out. This is our second step and our second step is that we are blending three ingredients and which are one cup yogurt. Bismillah. So yogurt. Our second step was soaked and peeled almonds. Bismillahirrahmanirrahim. Here you go. And our third ingredient was fried almonds. You already had water in soaked almonds so we are not adding water at this point. So just blending it. Here you go. So now we will keep it aside and then we are going on our third step. Now we are using the same oil in which you just fried the onions okay in this oil. I already heated up the burner. We are adding one tablespoon of white cumin seeds in that. Bismillah. And three cardamom in that. Just saute it. Let it crackle. I love this crackling sound. As you can see, as you can hear it's crackling sound. Now we are adding one tablespoon ginger paste and one tablespoon garlic paste. Bismillahirrahmanirrahim. I love this aroma when you are frying ginger garlic paste. Oh my god. This aroma is amazing and actually it will give a very wonderful taste and aroma in your dish inshallah. Okay at this point we are adding chicken. Bismillahirrahmanirrahim. Half kg chicken. Now we are frying it. We are frying the chicken for about five to seven minutes now. And at the same time we are adding salt. Salt and chilies will be according to your own taste. I'm taking one tablespoon salt. Mix it up.  So frying it is the main thing. We are frying this chicken on medium heat. Okay. Chicken doesn't taste too long to cook. At this stage we are adding our almond paste in that. Bismillahirrahmanirrahim. We are adding half cup of water in the container so it will rinse it off because we don't want to waste any paste. Bismillahirrahmanirrahim. Okay now we will cook this chicken for about 10 minutes. At this stage we are adding our rest of the ingredients. See now it's cooking. At this stage we are adding seven to eight curry leaves and one tablespoon of chili flakes. Bismillahirrahmanirrahim. Mix it up and Bismillahirrahmanirrahim. Mix it up. Let it cover for 10 to 15 minutes on medium to low flame. We will check it after five to seven minutes. So we will keep an eye that we have sufficient water in that so it doesn't get burned. Smells great. Mashallah let it cook for another 10 minutes. So 10 minutes are over Bismillahirrahmanirrahim. See so you can see it it's cooking and I love this aroma and we are checking. So we need to cook for 10 more minutes. At this point we are adding this heavy whipping cream Bismillahirrahmanirrahim. So we just add the heavy whipping cream in that and now we will cook it till the chicken get tender inshallah. So let's cover it up and let it cook for 10 minutes inshallah. Our 10 minutes are over so Bismillahirrahmanirrahim. As you can see the oil are on the edges so that means it is fully cooked and the other thing at this point you have to check that chicken is completely tender. So as you can see there is no extra water and this is just a gravy thick gravy because we add almond and cream and everything so this is the time we will turn off the burner and then we will dish out this chicken. Now Bismillahirrahmanirrahim. Now we are taking it out Bismillahirrahmanirrahim. So our chicken is ready now we will garnish it with green chilies Bismillahirrahmanirrahim. This is Ramadan so we cannot taste it I hope you will love it inshallah you can eat it with rice naan or bread with this will go with everything inshallah. So don't forget to give me your feedback be ready for the new exciting recipe and cook with me next week inshallah. Please remember me in your prayers and see you next week. Asalaamu alaikum.