Are you willing to undertake a dangerous mission behind the enemy lines, knowing you may never return alive? What you have just heard is the question asked during the war to agents of the OSS. Ordinary citizens who to this question answered, yes. This is Cloak and Dagger. Black warfare, espionage, international intrigue. These are the weapons of the OSS. Today's adventure direct line to bombers. The story of an American OSS agent who during the height of the war, directed from the streets of Berlin, an American attack, is suggested by actual incidents recorded in the Washington files of the Office of Strategic Services. A story that can now be told. After you get back from a mission, you sit around and there's nothing to do but sit around. So that's what I did. I sat in a room in Milton Hall in England where OSS agents are trained. I thought about the restaurant on Sixth Avenue. I wanted to open after the war. I was never so bored in my life. Yeah. Hey, Nicky, the colonel wants to see you. Very important. Okay pal, tell my pal the colonel I'll be there and win the war for him. That was how it all began, November 1944. After that, I didn't have time to be bored. I know you've just come back from a mission in France, Lieutenant, so it's strictly up to you if you want to go out again immediately.  You speak German, don't you?  If I see him, I'll tell him. You may be closer to him than you think. Corporal? Yes colonel. Send in Professor Warburg. That's how I met the professor. He was a little guy with a beard. He weighed about as much as ten cents worth of liver. And he reminded me of my chemistry teacher back in Lincoln Junior High School. Professor, tell Lieutenant Olesnikos just what you told me. He's the greatest of pleasure, colonel. Lieutenant, I am an escaped political prisoner of the Nazis, and I am here in England illegally. And you just walked into headquarters and told that to the colonel, huh? Do you know you can be interned? I know that very well. But I can no longer sit by and be idle while I have a plan that I know can help the Allies. Professor Warburg suggests, Lieutenant, is that he be parachuted into Germany with another agent. Make his way to Berlin. I assure you I can move about Berlin blindfolded. I know it well. Berlin? This could be interesting. What then? Then with radio transmitter we could pinpoint military targets to American planes overhead. We could direct bombs from the streets of Berlin itself. Now wait a minute. Walk around with a walkie-talkie in the middle of a raid carrying on conversation with bombers? When do we leave, pal? I am ready anytime. Today, tomorrow, yesterday. The professor may have been ready yesterday, but the OSS wasn't. First we were briefed for weeks how to get food coupons in Berlin, how to buy a railroad ticket, how to post a letter, how to greet a German officer in the street. Little things, an American cigarette, an English match, a laundry mark could give us away. And there were big things too. We were grilled for hours on cover stories. Forgeries became documents, fiction became facts, passes, stamps, signatures, everything authentic, everything airs out, including my manners and habits. I was ready to pass as a citizen of Berlin. And then a plane took us high over German soil and we jumped. They made it, Nicky. Yeah. It's only a few kilometers to Berlin. We can walk it, make it before daylight. They should find the farmer who owns this field and say Dankeschön for providing us with so ideal a landing plane. Yeah, we'll send him a letter sometime. Right now let's get out of here. You will wait where you are. Kindly keep your hands at the air.  Or let my dog tear you to bits. You've been a good dog keeping so still. Well, as your farmer professor you still want to say Dankeschön. Still? Do not talk. You have made a mistake, my friend. My companion and I got lost trying to find the road. We came by accident on your field. That's right. We both of us only recently discharged from the army. If you would care to see our papers right here in this knapsack. If you don't keep your hands up, I will let the dog go for your trope. I do not care to see your papers. I saw you parachute from an American plane. Uh-oh. Walk now to the barn. Rolf will see to it that you stay there. Won't you, Rolf? The German farmer left to send the barn. He didn't have to lock the door. That big black doberman with the impatient fangs watched us as if he wanted us to make a move so we could jump.  Professor, don't move.  Just listen to me. Yeah, I'm listening. There's some harness straps hanging on a hook right over my head. I noticed them when I came in. I pull them down fast enough.  Yeah, buddy. There's some horse blankets near you. When I pull down the straps, throw the blanket over them. It's got to be fast. Better work. I'm ready. On three, then. One. Nice, boy.  Three. The harness caught on the nail as I tried to pull it down. The dog leaped at my neck, and then the nail came off too, and the straps fell across the dog's snout. Professor flung the blankets over the dog's head. I have him, Nicky, but I can't hold him. The shovel? Where's that shovel I saw? Hurry, hurry. I can't hold him. Now, I hit him again and again, and then suddenly the only sound in the barn was the dull thud of the shovel. The dog didn't move or make a sound. It never worked yet. We had better get out now. Yeah, let's go. Ah, the smell of a bakery is always good. Ah, how fortunate it is. I have only this morning made pfeffa kuchen, Joseph. Just the way you always liked it. How good to see you again, Anna. I told my friend, Nicky, that you would take us in. Help us. Of course, Nicky. I will do anything I can. We may stay here then, Anna. If all goes well, we will leave right after the raid tomorrow night. Yeah, 24 hours all we need. Of course you may stay. I still live above the bakery. There is an extra room. My grandson, Emil, will not be home from the youth camp for a week. Youth camp? What could I do, Nicky? What could anyone do in these days in Berlin but ride with the wind? Until there is a chance to fight against it. Helping you and your mission will give me my chance. Little Emil, eight years ago seemed like only yesterday. I used to sit with him on my lap here in this bakery and twirl my gold watch on the chain for him. Remember, Anna, how he laughed? Yeah, I remember. He has forgotten you by now. And you would not know him. He's 13 years old. Oh, 13 years old? Already they have poisoned his mind. I cannot get to him. I do not dare. He's a little parrot speaking only what has taught him. Nicky, some more coffee? No, thank you for our lightness. More pfefferkuchen or Apfelstrudel, a specialty of my shop. Apfelstrudel. No, thanks. Six years ago at this very table I had Emil on my lap when the Gestapo walked in and arrested me. They did not like what I thought in their school. What's that? Someone's coming? I don't know who it can be. Customers never come by this late. Clan mother, surprise. I'm home. Emil! What is this, men? Emil, your manners. These are friends. Just passing through Berlin. They are just staying the night. This is Herr Neudeck and Herr Josef. We get it. Heil Hitler. Oh, yes, of course. Heil Hitler. I did not expect you until next week, Emil.  I want a great honour which I want to tell you about. I did not know I'd have to share to a stranger. Shame, Emil. These men were soldiers of the Fatherland. Yes, Emil, we were both with the elite guard of one of Rommel's panzer divisions. Rommel? Yes. That is before we received our medical discharges.  I will bring you something to eat. Don't you want to hear about the honour you received? Grandmother, on my sleeve. A red swastika. Yes, red for the youth movement. And a swastika because I learned my lessons faster than the others. The commanding chief of the whole youth movement awarded me my swastika. And he told me I could take my vacation a week early. Are you proud of me, grandmother? Yes, my boy. Yes, let me get you something to eat. Oh, no, no, no. I am too tired. Going up to bed. Grandmother said you were staying here. Will I see you in the morning, gentlemen? Well, I'm not sure. Oh, they will be here. Now that you are home, Emil, I will sleep on the couch and give them my room. No, no, please. Oh, it is all right. It is settled. Good. Perhaps then you also, if you will tell me about Rommel. A great leader. Yes, yes, perhaps. We will see you in the morning, Emil. Why do you stare at me? Do I stare, boy? I thought so. Have I met you before, Herr Joseph? No, I am sure not. Your face. Ever since I came in. Grandmother, have I met him here before? No, no, Emil. Herr Joseph was here before you were born even. You have never seen him. It has been years. Fifteen maybe, before you were born. I suppose so. Professor, he wouldn't remember, would he? Oh, how could he, Nicky? He was a baby that last day you would have saw him, barely five years old. And the professor was thirty pounds heavier, at least, and clean-shaven. Anna is right, Nicky. Do not worry. He could not remember. Do not worry. But I couldn't help worrying. I lay awake half the night thinking about that kid in the room next door. The thirteen-year-old puppet with the new red swastika. It was just a feeling. I had a funny kind of feeling at the pit of my stomach that made me wish they had kept him in that youth camp until after we were gone. When I got up, the sun had been up for hours, and so had the professor. I went downstairs to the bakery. There was the smell of fresh bread baking, and I knew for our light and it was in the kitchen. But the professor was sitting at the table, swinging his watch on the gold chain and talking to that German quiz kid. But where do you want to know? Oh, I'm just interested. I want to see how well you have earned that swastika. I stood at the bottom of the stairs and listened. We have a leader who is revolutionized German. He is the greatest man who ever was or will be. When I joined the Führer's organization, the man in charge said, Join no organization but this. Forward, forward. The banner leads us to eternity. Oh, you have learned your lesson well. Yeah, Joseph. Are you sure I have never seen you before? Of course not, my boy. I seem to remember. Hey, Joseph. Ah, good morning, Herr Neudeck. Since we're just passing through Berlin, don't you think we ought to see a few of the sites before we leave? Yeah, yeah, you're right. We will leave now. Perhaps later, Emil, we will talk more. The raid was scheduled for that night. The professor and I had a lot of work to do. We made arrangements to meet about 4.30 that afternoon at a tavern on Willemstrasse. We went separate ways. I did a lot of walking. And I made a lot of notes in my head. The Klingenberg power plant was still functioning. The Osterkreuz junction of the city railroad had been repaired. There was an ammunition dump on the north side that our bombers couldn't see from the air. It was a nice day. A lot of Germans were walking the streets. And I made a lot of notes in my head. You've reached the order now, Mein Herr? Nine, nine later, I am waiting for a friend. The professor was 15 minutes late, and I started getting nervous. Maybe somebody had recognized him. I sat there and sweated it out. 15 minutes, 20 minutes, half hour. And then he finally came. But he wasn't alone. Herr Neudeck, this is Hauptmann Müller. We met only this afternoon, and I invited him to come and have dinner with us. It was not quite that way, Herr Neudeck. It was I who insisted upon coming alone. I give this a tongue. You were with one of Rommel's Panzer divisions, I understand. Yes, we were only recently discharged from the army. Myself, I am just back. We will have much to talk about.  They're never around when you need them. He will be here presently. Presently is not soon enough. I will go to see him myself. Have you right back? Where did you pick him up? He found me, my friend. There is a reservoir near the rail line. I was looking around. I think he was a little suspicious at first, but when I told him I was with Rommel, he became more friendly. I am beginning to believe I was in Africa myself. Just the same, I wish you could have shaken him. What did you find out? It was a profitable afternoon. And you? A profitable afternoon. Goat. Shh, he comes back. Ah, yes. At first it seems strange to me that Herr Joseb here should show so much interest in the reservoir. Well, I was nearly taking a stroll, getting reacquainted with Berlin. Then I watched you. I saw you walk down towards the rail line. That was when I stopped you and began to talk. We are both glad you did, Herr Hauptmann. Give us this opportunity to get acquainted. Yeah, yeah. I hope we shall see more of you while we are in the capital. Perhaps, Herr Neudech. Perhaps you shall see a great deal of me. I think I shall call the waiter and order some bread. I see you have not yet finished your meal, Herr Neudech. That's deleting. It's very good. Our diet at the hospital was not so varied. No doubt, no doubt. Everything I ate stuck in my throat wouldn't go down. I knew that German officer was watching me as he talked. Watching me strangely and I didn't know why. I knew that something was wrong and I didn't know why. Professor felt it too. Her name is Gertrude. And she has friends. Very pretty friends. You would like to meet them, perhaps? Yes, you would like to very much, Herr Hauptmann. How you would have enjoyed them. We might have had great fun together. All of us. Unfortunately, you may be otherwise engaged with the Gestapo. What did you say, Herr Hauptmann? I have been watching you all through dinner, Herr Neudech.  Do not move either of you. I have my hand on my gun. Well, surely you're joking. No, European. It's the way you do. To change the fork from the left hand to the right after the knife is used. At first, it escaped me. I just knew something bothered me. Then I realized what it was. There it was. The little thing that would put a rope around my neck. Only Americans hold the fork sideways in the right hand. In my nervousness, I'd forgotten a little thing like that European manner of eating. The Gestapo would be very pleased. The sharp knife I'd been eating with was still in my hand. Almost as if it moved by itself. It disappeared under the table and halfway into the German office. Good work, Mickey. Good.  We're not out of this yet. Waiter, waiter. Check, please. A friend has had a little too much to drink. We will take him home. In the two of us, we managed to get him out of there. His head was rocking back and forth like a drunk. The knife was still in him, so the blood didn't flow very much. We kept his cape around him. All right. There is no one around here, Mickey. We can dump him behind this shed. All right. We're beginning to leave a trail a mile long. So long, pal. It was nice meeting you. Come on, Professor. Let's go. The bakery, there was more trouble waiting for us. Trouble 61 inches high, weighing about 110 pounds. Wearing a new red swastika on his arm. They are in the kitchen. Something is wrong. I don't like the sound of that. Come on. This morning, when we were at watch on the chain, I thought I'd remembered something. And just now, how I see... I've never seen her use it before, Amy. I have when I was very little, the Gestapo. They arrested a man with a gold watch on a chain.  Amy, they do not even look alike. What about this, this broadcast radio I found hidden in your bedroom and a hat box? I... I... It's called a walkie-talkie, Amy. You'll give it back to me. Mickey, use it. Come back. You see? You see we've wasted time. I should have gone to the authorities right away. They have tricked you, grandmother. He knows, Anna. You're putting him here hoping you would return. What did you say? You knew, grandmother, didn't you? They didn't trick you at all. Traitor.    Mickey, get him. You signed to run. I got him. Let me go. Let me go. I report to the Gestapo.  They have you shot. You're not going to report anyone. What'll I do with them? Upstairs, his bedroom. Lock him there until after you have gone. Right. Let me go.      You cannot stay now. Professor is right, Frau Leitner. That kid upstairs will turn you over to the Nazis so fast you won't know what happened to you. My little Emil turned me in. You, sir. Would he? Yeah, I'm afraid he would, Anna. It is best that you come with us. We are going to try to get through the lines into France. Once there, there are underground workers who will help us. Yeah. Mickey, is it all right if I bring this tray of food up to him? He has not eaten.  Yeah, sure. Sure, you. Oh, take it up, but don't untie his hands. Remember? Yes, I will remember. The raid ought to start soon. Let's go over this map and make sure we have everything right, huh? Yeah. Now, the rail line is here. Mm-hmm. Sector 2, grid B3. And if Obama's knocked that out, Berlin's transportation is completely crippled. And here, in the map, power plant is in sector 6, grid G5. Lucy, Mickey, he's gone. What? Yeah, his hands. He got them loose. He lowered himself from the window with the bedsheets. What are we to do? He'll bring the Gestapo back with him. We don't know how long he's been gone. Professor, the window, quick. Yeah. The back door. There is a car coming. I can see it. There is an alien. Now, look, look, no time. They'll have this place surrounded. How do you get to the roof? The roof, yeah, yeah. Up those stairs. We can go to the other roof tops and perhaps escape. There better be no perhaps about it. Moving up to the attic stairs and onto the roof. You could see the Germans from there. Four of them in black shirts spilled out of an armored car. Two of them broke in through the front door. Two of them started around to the rear. And then we heard, amen. Nikki, she's dead. Pearl, it wouldn't do her any good if we stay here. Come on, cross the parapet. Oh, that's music for my ears. At least they'll keep them from getting more help right now. Stay where you are. Come and get us, Pearl. One of them did try to come and get us. And he got it first. Right between the eyes. He swayed for a few seconds back and forth, and then he fell off the roof onto the street. That's one of them, Nikki. There are only two left. Two? Well, what happened to the third? Nikki, look behind you. Fourth Nazi had come up the other way through somebody else's attic and onto the roof behind.  Now there are just two left, Professor. Professor, what is it? My leg. I can't move it. I can't go any further, Nikki. What happened afterwards was a nightmare. It was if the earth cracked wide open. It was red, hot, burning, and the noise of the planes and the air-gag and the German guns and the bombing made my stomach turn. We crouched behind a parapet, and I held them off while the professor directed the bombs. Attention. Attention, bombers. The Klingenberg power plant is still functioning and supplies electric power to vital industries. Bomb sector 6, grid G5. The Oscroids junction of the city railroad has been repaired. Knock it out, and all traffic in Berlin will be stopped. Sector 2, grid B3.  While there is a chance, I can hold them off long enough for you to get away. I can't leave you here. No, no, they won't take me. Don't worry. Now look, I'll carry you. We'll make it. Come on. Listen, listen to me, Nikki. Go across the next two rooftops and then down through the skylight. There is a tailor shop. Professor, go out the back door there. It leads to an alley. Once over the fence on the cover of the raid, you can make it. Now look, I won't go without you. All right. I will change your mind. Attention. Attention, bombers. Hey, what are you doing? Attention, bombers. Impeditive. Wait two minutes and bomb crossroads at sector 7, grid D3. Professor, what are you doing? You're crazy. That's here. This sector. Go on, run. Run, Nikki. I'll cover you. I stumbled and fell and got up and ran again. When I got down in the alley through the tailor shop, I kept on running. And then the bomb fell and the concussion rocked the ground and I went flat up my face. I looked back. I knew that our bombers had made another direct hit. The professor had not only held off the Germans while I got away, but kept them there until it was too late for any of them. A little German bakery that specialized in Opfelsstreutel, folded up as it had been made of matchsticks. Somewhere in the wreckage, the professor with his gold watch on the chain was buried under it. And overhead, the planes headed back. There was nothing left for me there. I headed back, too. Lieutenant Gasolassnikus made his way to France and after months from there to England. But his direction of the bombing raid from the target itself kept some of Berlin's major industries crippled and its transportation system paralyzed. And once again the report of an OSS agent closes with the words... Mission accomplished. Listen next week when we again present... Cloak and dagger. Heard in today's Cloak and Dagger adventure were Everett Sloan, Bill Zuckert, Lily Darvas, Barry Kroger, Michael Artist, Raymond Edward Johnson, Carl Weber, Jerry Jarrett, Bobby Weil and Brad Barker. Script was written by Winnerford Wolfe and Jack Gordon. Music was under the direction of John Gart. Today's true OSS adventure was based on the book Cloak and Dagger by Corey Ford and Alistair McBain. This has been a Louis G. Kahn production in association with Alfred Hollander and was under the direction and supervision of Sherman Marks. NBC offers three of radio's top mystery adventure shows, The Big Guy, Sam Spade and The Saint. So if mysteries are your meat, listen in tonight. Next here, High Adventure, then The Big Guy on NBC.


I'm fixing one of the Army's most deadliest weapons, the Abrams. This is the tip of the spear for the Army. My dad joined the military and he did 20 years and his grandfather was also in the military so it's a family tradition. I also want to serve my country so I think it's no better job or honor. I did five years act of duty in the Marines and then I got out the two and a half years in the reserves and I wanted a different challenge. I was actually going to go back active duty in the Marines but they only gave me two jobs. None of those jobs at all motivated me. The Army recruiter gave me a list of jobs. I chose tank mechanics because it sounded most challenging. I already have passion for working on vehicles, right? My first car I bought was $2,000. I bought a dud. I had a choice. Either I could pay someone to fix it with the little bit of money I had or I could learn how to fix it myself. That's kind of what sparked it. Being able to fix my own equipment, that makes me feel good. You really have to adapt and overcome a lot of challenges in order to get these tanks up and running. The satisfaction is to be able to fix a problem that applies anywhere in life. Tanks is definitely one of those. I mean the Army, this is their main weapon right here. So being on this team, knowing that I'm fixing the tip of the spear definitely drives me. It's something to be proud of.


Hi, I'm Matthew Koost, head dating coach at commitmentconnection.com. And in today's video, we're going to talk about how men test women before they get married to them. And so if this is your first time to our channel, make sure that you go down and hit the subscribe button to get more videos on how to attract and keep the guy that you want to have in your life. So there are a lot of men who have been burned in relationships, in marriages. A lot of guys who have had women who have kind of taken a lot of money from them, who've lied in courts, who've done a lot of things. I used to be in the military and when I was in the military, we had this happen all the time. Guys would come back from a deployment and they would show up and their wife had taken everything out of their house, sold everything and left a note saying, hey, we're getting a divorce and then ended up taking money from the guy, ended up, you know, sometimes taking the kids away from the man and the man got really, you know, they get really frustrated, you know, it's a frustrating thing. Divorces are a frustrating thing. And I'm not saying that you should stay in a bad relationship or stay in a bad marriage. What I am saying is that guys are really hesitant these days because a lot of the marriage or a lot of the divorce laws really heavily favor women. And so a man, if he even thinks that or if he comes from a family like mine where they have lots of divorces, I mean, you know, half the people in my family have been married and divorced three times. And if they come from spaces like that, they're a lot more hesitant to get married. And they want to make sure that this woman is somebody who's not going to take advantage of them. They want to make sure that this woman is somebody that's really awesome and is going to, you know, that they can grow together and have an awesome life together. So I'm going to give you five things that men tend to test women for before they get married to them. Number one is, is this woman using me? So this is one of the biggest fears that a lot of guys have because a lot of women will just use men, right? They'll use men to be in a relationship with somebody. They'll use men to be like, oh, look, I've got this guy who's really rich and who's got a lot of things going on. A guy will test a woman to see if he thinks that she's using him or not. And so there's a few different ways that a guy might do this. And the first way is that he will bring up the topic of a prenup, right? Because a prenup is kind of like this thing that shields a guy from a woman taking advantage of him. And so if he brings up this topic, whether he's serious about it or not, he'll look to see how the woman kind of reacts to this idea of a prenup. And if she freaks out and loses her mind, that's a good signal to the guy that this is the type of woman that he does not want to get married to. So test number two is this test about does she feel like she's actually an equal partner in the relationship? Is she willing to pay when the guy doesn't have any money? And so a test that some guys will do, and I've heard guys talk about this before, is what they'll do is they'll go to somewhere after they've been dating a woman for a while.  And what they'll do is they'll say, oh, man, I forgot my wallet. I don't have my wallet with me right now. And the woman, and he'll wait and watch to see what the woman does. If the woman's totally cool about it, and she's like, oh, don't worry about it. You've paid for me so many times, here I'll pay for it this time. If the woman does that, that's a great sign for the man. If she doesn't, if she freaks out and she's like, oh, well, what do you think? I'm going to pay for things? That's a really bad sign, right? And it shows the man that she's kind of using him for his money. So the third test that he's going to do under this, is she using me test, is a lot of guys will look to see if the woman's high maintenance. And so high maintenance women, what we mean in this case is, is she going to spend all of my money, right? Is she in debt? Is she bringing debt into this relationship, like credit card debt or something like that?  And so a lot of guys, like if you want to be a great marriage material for a man, help him save his money.  It's going to be a short marriage because he's going to feel like he can't provide for you and that it's too much and you're taking too much away from him. So the second test that guys usually use to find out if a woman is really marriage material or not is, are you going to cheat on him? Does he feel like you're the type of woman who would cheat on him? And so the first test that I've seen guys use, I used to talk about with other guys and whenever I'd see this happen in the relationship, if it was going on with a guy, I'd always be like, get out man. This is not a good relationship. This person is probably going to cheat on you or she's going to make you feel really bad at some time in the future and it's called the loyalty test.  If she does, that means that she's much less likely to be loyal to you. If she doesn't, that's a good sign. If when you're with a guy, you're with him, you're not going and flirting with other people, it's like, hey, I'm with this guy, I'm with him. That's what a guy wants. He wants loyalty. And if a woman is running around flirting with other guys, every guy knows. As soon as he sees a woman go and do that with other guys, he looks at the guy and the other guy looks at him and the guy's like, come on, man, really? And the other guy's like, yeah, I know, but I like her.  And so a lot of guys will use the loyalty test. So another test to see if a woman's going to cheat on him or not is looking at what she says about him behind his back. And so a lot of people will start talking about you to the man. If you have friends that are in common, if you're friends with his family, if he's friends with your family, he's going to hear things that you say about him. And if it's bad things, that's not good. You should only be saying good things behind his back to other people because that's all about loyalty. Is she going to stay faithful? Is she going to stay committed to me?  He's going to feel like you don't really respect him and you're not really loyal to him. And that could destroy any chance of you being marriage material for him. So number three is, is she going to restrict his freedom? So this is the third test and a guy tests for a woman to see if she's going to restrict his freedom. What this means is when he wants to go and hang out with his friends, when he wants to just hang out and have a chill day and just relax, what is she doing? Is she saying, no, you can't go and hang out with your friends? Is she saying, no, I'm going to fill up your day with a whole bunch of things that you don't want to go and do? So he's going to test her desire to restrict his freedom. And so if he can have time to himself, if he can have some space to himself, if he can go and hang out with his friends when he wants to, that is a test that a guy will use to see if you're somebody that's going to take away this thing that is very, very important to men, which is freedom. The second way a man tests to see if you're going to take away his freedom is if you pull him away from his passions. And so a lot of times a guy will have something that he's really working on that's really important to him. And there's kind of a fine line between being like, hey, you know, we've got this other thing that we already planned, let's go and do it.  And so a lot of times women will associate his passion in a negative light because she feels like it's taking her man away from her. And I get that. I totally get that. But at the same time, it's something that's really important to him.  You know, and so that's another test that a guy will have. So the last test that I want to talk about is this test of knowing how to do basic human being stuff. And it's really interesting in this day and age, there's a lot of women that don't know, there's a lot of men and women that don't know how to do very basic human things, right? Like knowing how to cook, knowing how to clean up after yourself, knowing how to function on your own, knowing how to live in the world without needing somebody to be there and do all those things for you. And it's just, it's fascinating to me, this isn't like, I'm telling women that women need to cook and clean and stuff. I know how to cook, I know how to clean, I know how to function on my own and a lot of guys do these days as well and they look at a woman and they're like, does she know how to do these things to the extent that he does, right? If a guy meets a woman and he wants to end up having kids and stuff and she has no idea how to function and be a part of that relationship where she can kind of take care of those kids and make sure that the kids don't run off a cliff and die or something, he's going to be much more wary of whether he wants to be in a marriage with that woman or not. So these are the things that a man tests a woman for to see if she's marriage material and I hope they didn't kind of come off as kind of mean, but those are real things that men test women for to see if they're marriage material and it's important that you know what some of these things are, if you want a man, especially a man who's been burned before or a man who's been hurt before, if you want a guy like that to end up getting married to you at some point, you have to be the type of woman that he'd want to get married to, men take this idea of marriage and commitment very, very seriously and women seem to take it less seriously for whatever reason, but they're like, why doesn't he marry me? It's like, well, are you somebody that he thinks would be a great person to get married to? You know, and if you're not, that could be a really big problem in your quest to get into this marriage.


The most asked question in a TEFL interview, how would you go about teaching a specific lesson to a group of young learners? It's not uncommon for interviewers to ask how you'd teach a specific lesson to a group of kids at a certain age level. For example, you might be asked how you'd go about teaching professions, or going to the store to a group of 5-year-olds. Try not to fall back on using flashcards in class to teach words or sentence patterns. Interviewers hear this all the time. It's not an original idea and will not gain you any points in your interview. Prepare a mini lesson in advance that you can adapt on the spot in your interview. Thanks so much for watching. We are ITTT, the leading provider for TEFL and TESOL training courses. If you like this video, please subscribe by clicking the button down here and click on any of the videos here on the left for more interesting teaching tips for getting certified to teach English abroad and online.


Carrie Sletton. Carrie currently works for Iceberg Web Design in Minneapolis, Minnesota, building custom WordPress websites. She loves using her creativity and diverse background to solve all kinds of problems. A noted extrovert, Carrie owes me a big kick. Give it up, Carrie Sletton. Thanks, everybody. Can you guys can all hear me OK? I hope you're ready to have fun. We're going to have so much fun. Performance are really fun. But I do want to get you guys a little bit to see where we're at here. How many of you have been developing custom themes and WordPress for more than five years? All right, you're not in the right room. I probably want to go out there. How many of you guys are kind of more new to WordPress? Just kind of more getting started. It might be your first word camp. Raise your hands. All right, so this talk is really aimed at beginners. I really wanted to give you guys things that you could go home and use immediately. When I first started attending word camps, I was very overwhelmed by some of the level of technical difficulty at the presentations and felt like I didn't belong, and then felt like I had to go home and do a lot of research to implement some of the things that I had learned. And I wanted to give you guys some wins early on and teach you guys some things that you can go home and use right away.  OK, every website has a form. They're all over the place. But forms can do so much more than just collecting a name and an email address. I'm going to show you some of the things that I've done with forms. There, we're going to talk about using conditional logic. We're going to talk about passing variables from one form to another. We're going to talk about creating dynamic surveys in ways that you can display the results. And we're going to talk about generating custom PDFs. So my slides, I do have small writing and a lot of detail. So I would say, don't try to read it. Don't try to take notes. I will have a link at the end, and I'll tweet out a link. So maybe just follow me on Twitter if you want to see my slides. There are examples kind of step by step, and there are links to the actual websites that I've built with these actual forms. OK, why should you listen to me? Because I love forms. We already had an introduction. I'm not going to go through my whole history. I work in Minneapolis. I do custom word press development. Used to be a freelance website developer, and I've also been a stay-at-home mom, an information technology director, and worked in geographic information systems. So this is kind of like my third career. So a lot of what I talk about uses the plug-in gravity forms. There are 1 million different plug-in, different form plug-ins, and I'm not really here to have a debate on which one is the best. They all are pretty similar, and I'll do a lot of similar things. I personally use gravity forms in every website that I built. I'm very familiar with it, and it has really good documentation. There's a really big community of users if there's something that you want to do, and you think maybe you could do it with a form. Chances are somebody else has done it. They've written some code for it, and they've posted it in a knowledge base. So OK, so now we're just going to get started. Conditional logic is something that sounds complicated, but it's a really very simple concept. If you tell somebody that you're going to build them a form with conditional logic, they will instantly hand you twice as much money. So it's a good thing to know. So basically, like I said, I'm going to start at the very beginning. Conditional logic basically means that you want different things to happen under different circumstances. So we are at a word camp. Everybody loves swag at work camp. So here's my example. If I wanted to give you some swag from icebergs, of course, we put a penguin on everything. How am I going to know what to give you?  But if you're not a beer drinker, I'm not going to give you a bottle opener. So if you happen to be addicted to LaCroix, I'm going to give you a canned koozie. So I would need to know what your favorite drink is, and then I would respond differently, depending on what that answer is. So that's kind of how to think about it when you're working with forms. When you use conditional logic, it just means that you want something different to happen depending on what information they're giving you in the form. So I actually made a form for this. So here is my first question.  So it has a radio checkbox for I like to drink beer from a bottle or I like to drink LaCroix. So how would we actually go into gravity forms and make something different happen depending on which answer they select here? In gravity forms, after the general tap, there is an appearance and advanced. So in advanced, you can check the box to enable the conditional logic. And then it's just kind of plain English, so it will walk you through the steps. So I want to show my field, so I made my question field, and now I have whatever information I want to display. And so I want to show the field if the following condition is met. So what is your preferred beverage, beer from a bottle? That's the first answer that they could select. So if they select that, then show the contents of this HTML block. Let's see an example. So this information down here is in my HTML block. And so I'm telling gravity forms to show this HTML block if this is the thing that's selected. So let's talk about a real life example of when we did this. So we always have consultations with our customers and talk about their processes and maybe ways that we could improve things for them. And so this is a customer that we had that is like a shipping broker. So they match truck drivers with people who have loads that need to be delivered. And so they originally came to us and they just, hey, we're new business. We need a website to prove that we exist. But we sat down and started talking to them about how they work and their processes and found out that they were having a problem where they have a registration form that's a PDF-based form and they want to make all of the fields required, but not necessarily all the time. But the times when they do need to be required, they really need to be required. So for example, if you're applying to work with them and you use a factoring company, they need to know the name and address of your factoring company. So that needs to be a required field. But if you don't use a factoring company, you don't need to fill out that field, right? So they were having all kinds of problems with their fillable PDF of making fields required or if they didn't make them required, then they weren't getting information that they needed. And so I said, well, I can make you a conditional logic form for that. And they instantly handed us twice as much money. And so for this example, it's a similar kind of thing where you answer the question on factoring, does your company use a factoring company? And if you say yes, these fields show up and they're required. But if you say no, the fields don't even show up. So the fact that they're required doesn't matter. Another example of conditional logic is another form I built for a company who wanted kind of like a help contact us, like a help us kind of thing where they're really, really their customers would end up doing four different things. And they had a huge like, if they answer this, they had like a flow chart for me. If they answered this, then we want this to happen. You know, I kind of said, well, it seems like really you just have four different areas and you want four different forms to show up depending on the thing that they need help with. And so I made this form for them where it starts out with just a call to action. What can we help you with today? And then depending on which button they select, the rest of the form shows up. And so the beginning of this form is just regular radio buttons.  And it actually looks really cool and works really the way that they wanted to. So we're gonna talk about conditional logic a lot in some of the other examples, but I'm gonna move on to another thing that I do a lot in websites. And this is passing variables from one form to another. So with some of our websites designs, we may have a homepage that has a tiny little call to action or a tiny little form that says request a quote or for this case, this is a Montessori school.  And they see three simple fields, no problem, I do wanna schedule a visit.  But we don't want them to re-enter the things that they've already entered on the short form. So we're gonna pre-populate the second form with the data that they entered in the short form. So you can see this little penguin person that entered the form data. Their data automatically got populated into the second form. So how do you do that? You do that by passing variables. So typically when you would fill out a form, when you click submit, there's just text that returns that says thank you for filling out the form. Well with gravity forms, you can control what you want to happen when your form is submitted. And so in the settings, you can use different options for the confirmation. So the confirmation that they've successfully filled out the form, what do you want to happen? In this case, we don't wanna show them any text. We don't wanna thank them for filling out the form. We want to redirect them somewhere else. And we wanna bring some data with that redirection. So we click the option for redirect and then we have a URL. So the URL is where the longer form lives. And then we're gonna pass some data via a query stream. So first you would make your short form and then you're just gonna assign some variables. You can name the variables anything that you want. It's always a good practice to use self-documenting code and you do something that makes sense. So for this example, I have two fields. Name one, which is first name and name two, which is last name. So I'm calling these variables name one and name two. And then I'm gonna set the variable equal to a field from my short form. And so you can just select the field from the little dropdown. And this query string is gonna pass this data with it into the URL. In the longer form, what you would do is set up your fields that are gonna be able to accept data to them and then put in the name of the variable that you selected. So if you had called them first name or last name, in the second form, you're just saying allow the first name to be populated by any value that is set to name one. Here's another kind of little bit more complicated example of this. So this organization is the Minneapolis Police Activities League and they run sports programs for kids in the neighborhood. They run football, T-ball, basketball. They have a brain and body camp. But they only want one form for all of the different programs. But baseball doesn't go in the winter and hockey doesn't go in the summer. So they were getting all kinds of people that were registering for a program or saying that they wanted to do a program that wasn't in season. So they wanted kind of a simple way to open registration for some sports, close registration for other sports, but not have to have a different form or do a lot of work, switching out content on their website. So I made a little first form. It's just a one field form that selects the program that they're interested in and then there's some conditional logic that displays depending on what they select and then it brings them to the longer form. So if you select golf, it's gonna say registration is closed right now. If you select football, it's gonna say, oh, registration for that is open and here's your register button. And then when you click the register button, you lead to the second form and the program that you're interested in is already selected. On the registration form, if you just go to the registration form without following the short lead-in, if you select one of the sports that you can't register for, the submit button doesn't even show up and says this form, this sport isn't available right now. So this form was created the same way. This short form has a valuable called sport that they register to and then that variable is passed to the longer form. You can also pass a variable by just simply including the variable in your URL. This customer again had kind of a unique situation, always starts with sitting down and talking through their process and they are attorneys and they are gonna have profile for each of their attorneys online. Okay, great. Do you want contact information on your profile? Do you want direct telephone line email address? And they said, yes, we want email address listed. We want them to be able to email us. And then they said, no, we don't want email listed. We don't want them to be able to email us. What they didn't want is they didn't want people accessing their individual emails. They wanted to have control over whether or not they were gonna interact via email with our particular potential client. And so we created a simple just email button and then that is passing a variable into the form. So we created the form where you can select who it is that you wanna email and then there's conditional logic on the backside of the form, routing it to the right person. And then for the profile, when you select email Ellen, you don't see her email address. You're just brought to the form. Her name's already selected and then when you submit it, it routes to her. So how do we get the URL that says email Ellen to pass the information with it of who is gonna email? Well, you simply do that in the URL. So here's my WordPress content editor and normally for a URL, for a link, I would have an href and then just the address of the page I wanted to bring them to. Well, all I have to do is on the end of the URL, a question mark and then a variable and then a value for the variable. So I'm assigning a variable of send message to and then I want it to be Ellen. In my form that I'm passing this data to, when I have the radio button of the different or the dropdown of the different people they can select, I can also give a value to those. So with Gravity Forms, you can choose to enable values or not enable values. If you just have a form with some radio buttons and you don't necessarily need a value, you can always leave this off. But if you want to give a value to these different choices, you can give it a value. So in order to email Ellen, I need to pass this value of Ellen. So the URL that you're leading them to is the contact us URL where the form lives and then send message to and then this value is Ellen. This is an example or this is showing the conditional logic for the form once it's submitted. So these are form notifications. And so you can set conditional logic up in the form notifications, similar to how you can show or hide different fields based on what the answers are to questions with conditional logic. You can send messages to people and then have some parameters that they have to meet in order to send those message. So we're only gonna send messages to Jackie if the selection is selected Jackie. Dynamic surveys. Here's another example of ways to use forms to kind of display data. So for this form, what the customer wanted was a survey. Okay, so first I'm thinking, all right, okay, survey. Question, each question has points out of all the points when you're done, here's your results. Nope, that's not what they wanted. What they had were 30 questions on their survey that were measuring things over seven different domains. And each question might be weighted a little bit differently. And so once they fill out the survey and they have these weights for their questions, they're gonna get a score and then we wanna compare their score to an industry standard and tell them what their score was and then tell them how they compare to the industry standard. And if they don't match the industry standard, if they're below industry standards, then we wanna try to sell them our services because these are consulting services. So for each of the answers in the survey questions, we, instead of assigning maybe a text value like we did for the email addresses, we're assigning a number value. And so for these, the values are pretty small. That way we can double them and then do some math with them to kind of account for like the different, the weighting and then averaging over the domain. So each answer strongly agree, disagree, neither agree, agree, has a value over here, okay? So a point zero one, a point zero two, point zero three, point zero four, point zero five. So if we double them, it's point zero two, point zero four, point zero six, et cetera. Okay, so now we do the fun stuff. So now we do some math. So in order to add up these values, all we really need to do is, all we need is a place where we can do math and then somewhere where we can store this value. So one of the reasons I like gravity forms and one of the reasons their documentation is really nice is they have filter hooks that you can hook into. And so you can grab ahold of your data after it's been submitted to gravity forms and you can do stuff with it, manipulate it before it gets then submitted. So this is my functions file and this is my function that I wrote in order to calculate the results of the survey. So the filter hook that I'm using is the G form pre-submission. So that is an existing hook from gravity forms that, like I said, grabs the data before submission. And then we're gonna run this function. And the function is evaluate results, right? Self-documenting code. Okay, so we start with a total of zero and then we're gonna add the value from the input. So the input, the ID number corresponds with the ID number from gravity forms. So each field in gravity forms has an ID and you can see those up here. So this is field ID one. So the input for whatever they select, if they select strongly agree, that's gonna be input one, okay? So we're just starting at zero. We're adding whatever they said here with whatever they said for the next question, with whatever they said for the third question and whatever they said for the fourth question. So those are the four questions for my first domain. Then I'm gonna do some math because I need to account for the waiting. We're gonna round it because we might get some decimal points in there. And so this math was all done like an Excel spreadsheet first to set up the weights of how we're gonna actually measure the results. So I just had a formula that I could copy and paste in here. And then we do it again for the second domain and then on and on until we get to the seventh domain. Okay, so now we're gonna display the results of that data. So once somebody is done filling out this form, they've answered all 30 questions, they see this webpage and it says, these are your results of your survey. So for your rule-making domain, your score was 50. And then here is a graph of that result. So here's your 50, that's your score. And then here's the top performers, they get usually a score of 95. And then here's the median. So you can kind of see really quickly, visually how you measure up against industry standards. And then that was a pretty good lead magnet into then selling a consultation. In order to display the results, the results, we used gravity forms again and you get to say what you wanna happen after the form is submitted. So in this case, we just wanna show them some text. We just want some text to display on the website. And so we're still within gravity forms using the confirmation. And so we still have access to, with this little button here, all of the fields that live inside of our form. And so we can say, all right, their score was whatever I had as the answer for this score in the last one. And then we were able to use just like a plugin that does like a skill bar where you can just put the number in. And so again, for the number, we're just using the values from our form to display on that bar. Okay, so let's make our own survey. Maybe we'll kinda try to keep the math a little more simple. So I'm just gonna have a quick survey on what's your spirit animal, right?  If you are sometimes that would be two points, rarely three points, and don't talk to me before 11, that's my answer. That would be four points. So in gravity forms, we're gonna assign a value and then we're gonna add these values up. The other thing that we need to do in gravity forms, and I don't know if I have a screenshot of this, is you need a place to put this value, right? That where you've added them all up, you have to store it somewhere. And so the easiest way to do that is just to create another form field that's hidden to the user. So the user doesn't see it and that's just maybe your result would be a good thing to call it. So you just create a field that's a result field and then after you've added your data in the functions file, you put that answer into your results field. So that's this part right here where it says set the score value. The score value is equal to your total here. So when you created your variable to add up your total and you put your input numbers in, then you're just using the same filter hook to insert that total into your last field that the user didn't answer because they couldn't see it. And then here's the example of what maybe your results page would look like. So you have two choices. You could either have only one results page, like we had with the example for the healthcare company, and you could say, oh, if your answer is between zero and five, then your spirit animal is a penguin. If your answer is between five and 10, then your spirit animal is a giraffe. Or you can have conditional logic that says if their answer is between zero and five, I wanna show them this page with a picture of the penguin saying that's what your spirit animal is. Or if their answer was above five, I wanna show them a completely different website, different webpage. Okay, so this is kind of my last cool thing that I like to do with Gravity Forms. And this is an add-on for Gravity Forms. It's called Gravity Forms PDF. And I'm pretty sure it's free, but it allows you to take form data. So normally when you submit a form, whoever gets the confirmation for that form, they usually just get an email that says, oh, somebody filled out your contact form, and this is the information they provided. Well, oftentimes we want to take that information and put it into a different display, make it look really nice with the PDF. For long forms, especially forms that may have like a signature, you might want that all to be bundled up in a nice PDF with the signature field at the bottom that somebody could print or file into a folder. And so this lets you take your form data and put it into a PDF. So we use this for a customer who does an online course. And once you finish the course, you need a certificate. They didn't want to handwrite all the certificates for the people who are taking their course. They wanted this to be more of a thing that you could do on your own. And so what we ended up doing for them is give them a password protected page. And once you finish the course, you get a password for the page. And then it's a really simple form where you just put the name that you want to be on your certificate, and then your email address where the certificate gets mailed to or gets sent to, the course that you finished, and then the date that you finished it. And then when you submit the form, you get the little text message that says congratulations on completing your course. And then what you get emailed to you is a PDF that has their form data in it, but you can style it with CSS or with a background image to make it look like this great little certificate. So here's the same example with the form that we had for the transportation company. They get a PDF form with all of the data and then the signature so that they can file these. Okay, so that was kind of my quick run through. So I can do an online or I can do a live demo if we want to do that or I can just take questions and we can answer questions. Does anybody have any questions? Yeah, do you want to use a microphone so everybody can hear you? Sure. All right, better, yeah. In the form that you had input one, two, and so on, that's obviously that kind of indexing is convenient for the computer, but for a developer or human beings, that does make sense. Is it possible to label them instead of give them a variable name or no under forms? Yeah, so when you have, so let's go back and look at an example. Okay, so when you have a field where there's multiple choices, if you want to use values, you can use either number values or text-based values. So if you want to do something like pass the variable and you want it to have a name so that you can reference it easily, they can be text-based values, that's totally fine. The reason that their number of values is so that we can do math. Okay, so on the certificate, you said you send them a password protected site so that they, URL so that they could create their own certificate. Yes. What happens if they put somebody else's name on the certificate? Yeah, I mean we talked to them, we laid out a number of options and they understand that that is something that can happen. They wanted something that was easy that they didn't have to monitor that where the user could create their own certificate. Yeah, but I don't make business decisions for customers, I make implementation decisions and so if they tell me how they wanted to work, I'll make it work that way but I don't tell them if that's a good idea. You want me to go to the end? Yeah. Yeah, so these slides are at, if you can't read this, it's icebergwebdesign.com slash phonewithforms and that's just a link right to my Google slides. So I have a quick question. Yes. I've never actually seen somebody pass data from one form to another. Yes. So we don't do very complicated forms in our work. I know there's functionality and gravity forms to do step-by-step forms. Yes. Like in what case would you use that versus passing data from another form? Yep, so the reason that I would pass data from a short form to a small form is more of, you know, they're more for like emotional reasons because you want somebody to only answer a little bit of the information and not make such a big commitment at first and then take them to where they have to make the full commitment. Where I would use a multi-page form is something like the Destination Transport website where they're filling out their application to be a driver or a carrier. They've already committed. They know they're gonna work with Destination Transport. I've got them. So I would take a really long form and that one actually is a six-page form and break it up into functional sections. So first I'm gonna collect all the information about the actual driver. Then I'm gonna collect insurance information, upload your insurance certificate. Then we're gonna talk about, you know, the terms of service and use gravity forms to do a multi-step form. So you're going, you know, and then there's a little, I think I might have a picture. Like you can see how far you are in the process, which is really nice. Yep. I didn't grab the whole thing on this page just the top, but. Can you answer correctly? Yep. All right, I think we have about 10 minutes, probably eight now. Yes, what is your question? For your certificate back here. Have you ever worked with like the gift certificate? So you're gonna establish a gift certificate number that's gonna change each time and then include them with a checkout? Yep. So similar, but not exactly the same with the form for the ticket system for the help form. They wanted each form submission to have a unique ID. And so for that, I did have to write a function that assigns the unique ID, but again, I'm using a blank field at the top. That's my reference number. And then in my functions file, I'm writing just a little function that assigns a unique number and that I just grabbed from gravity forms documentation. I probably didn't write it. I'm sure I copied and pasted it. And then putting that in the empty form field so that when they, it's not something that they enter, but when they get their email that says thank you for filling out your form, they have a reference number and it's gonna be unique. So they can just call and say, my reference number is, you know, yep. Anybody have any other questions? So gravity forms takes file uploads? Yes. Since gravity forms takes file uploads, how do you restrict which file or form that you can take? Just type them in. There's a field that says restrict to what formats and you say .pdf.ping and that's it. I love gravity forms too. I noticed that you're loading in contact form seven as well. Is there a feature that you're using that for? Nope, by default, the theme that I use brings in contact form seven by default. And so I usually just kind of have that out of the box, but I hardly ever use it. Let's see, I think I have a picture. Yeah. Okay, cool, perfect. Yep, I use that one a lot. No, the times when I've used gravity PDF, I basically want an external snapshot of the data that's not living inside of an email message. And so if formatting is an issue, there's templates that you can use when gravity PDF comes with some templates and so you can use one of their templates or you can, you know, CSS magic. So it looks nice. For the certificate, it's just a background image and then you're just putting in, but I've never had an issue where the PDF isn't grabbing some of the data. Whatever I would say can go through, it would go through. Yeah, if they're doing like a file upload, yeah, actually that's a good question. In this format here, they're doing a file upload because they need a picture of their insurance certificate and so gravity PDF, it just gives you a URL link. And so the image lives on your WordPress site and in the PDF, you have a link to it. Not to hijack my wonderful coworker, Carrie, but I'm working with gravity PDF right now to pull in information that wasn't on my gravity form. You can override the template and it's just a PHP file and anything you can do in WordPress, you can do in that template file. So I'm pulling in advanced custom fields based on post IDs and my PDF is quite different than what the form was that was submitted and it's all based on a post ID. So once you get into it, it can do anything you can do in a PHP template. It's very cool. The only problem is the CSS styling for it is PDF styling, so it's not necessarily the same as your standard CSS, so you just have to keep that in mind. Hey guys, hope you have a great rest of your work camp.


Let's get started. Any other questions? I'll take, like, questions for, like, three minutes until we're going to get to material. Yeah. On one more three. On one more three. Question one, part two. Question one, part two. It says to show that the grammar is ambiguous, but you only get two different parts. Yes. But the first part asks the two different leftmost part. Leftmost derivations. Or derivation, yes. So is the second part supposed to be rightmost, or is it just any? Because technically you could just copy and paste the first problem. So part of that is showing. So we know that something is ambiguous if it has two leftmost derivations, or two rightmost derivations, or two different parse trees. So this is showing you basically that they're the same. That you can make a derivation and turn it into a parse tree. So, yeah. It shouldn't be too, you should be able to easily take that derivation and turn it into a parse tree. I'm not 100% sure the best way to ask this question, but on the project, I did this sense from reading through it a couple of times, that there should be some way to use the same code to parse the input CFG as you used to process the CFGs that that one describes to you. Is that more trouble than it's worth, or is there a point to do that if you think about it and work on it a lot? I'd say it's more trouble than it's worth. So I would say the way to approach it is to parse that input however you can. Kind of like the lecture in part two, right? It's doing longest prefix matching, but it's not doing it exactly as we did in class, it's doing it more pragmatically. And so that's definitely the way. And you're welcome to use code from that we gave you on project two. I think I made a note of this on project three, but I'm going to say it now. Some of you get bit by it. The language in project two is not the same language in project three. So if you just try to take parts of the lecture out of project two and use it as is, it's not going to work right. It's going to really mess you up. So, you know, some things are super handy. Skip space. Super nice function, right? You can rip that function out and use it yourself. But yes, I would just go about parsing. Basically, you need to read in the input, parse it, and create data structures, right? So if you have a data structure for a context-free grammar, and its context-free grammar has a set of non-terminals and a set of terminals, and you have a sequence of rules, right? Zero or more rules. And each of those rules has a left-hand side and a right-hand side, where the right-hand side is a sequence of terminals and non-terminals. Cool. So that's your big step. If you do that and are able to read in everything about this data structure, then everything else falls out from that. It becomes a lot easier. Okay, one more question to context-free grammars. Okay. So we've been talking about, we've been talking about first sets. And so why have we been talking about first sets? Yeah, so we can figure out, just by looking at one token, which production rule to use. Right? And so we saw, let's say we have an example like this. S goes to the A little A.  So is there any choice here on S? Do we even need to read one token ahead? No, there's only one rule, right? If you can just do that. So let's think about the first sets here. Let's actually calculate the first set. So first set, let's go S and A. It should be very easy. Okay. So let's start first. Got this. Okay. So we can calculate this. So S. So first of S is, what am I going to look for here? First of big A minus epsilon, I'm going to add that to the first of S. So I look in here, there's nothing in here. I add nothing to nothing. I still get nothing. And do I move on and add little A? No. No, not possible. Okay, cool. Then I go A and then I say, so first of, let's say, first of A minus epsilon, add to first of A. First of A is currently empty set. So I add empty set to empty set, which is nothing. And I say, do I move on to the other symbol? No. Can't do that. So let's look at the other rule. So I'm the first of little B to the first of A. The first of little B is little B. And there's nothing to move on to. There's no epsilon there, so we're going to add epsilon to little five. So now I recalculate. I made a change. So I go through this again. I say, the first of big A minus epsilon, I add to the first of S. The first of big A minus epsilon is B. So I add B to S. Do I move on to little A? No. Done there. I go here. I do the same thing. I first of A minus epsilon to A. I get B and first of, I then add first of little B to B, so this does not change. If I go through this again, I'll get the same result. So the question is, so from here I don't have a choice. I know exactly which thing I should probably parse. If I was going to write parse S, I'd say parse big A, and then I'd do something else and work out this A. So how do I choose between the rule? Can I distinguish between these two rules? Yeah, so remember, rules are, so we have the rule that the first, if I add two, something of the form, like A goes to B and A goes to C, or A goes to alpha, A goes to beta, then the first S should not have anything in common. So I have first of A little A intersect with the first B. And so what's the first of big A little A? The second containing B. Intersect that with the first of B, which is the second containing B. Is that equal to the empty set? No. No, so I actually can't tell which one of these should apply right off the bat, right? Okay, cool. Now let's think of a different situation. It does not necessarily mean that the grammar is ambiguous. Ambiguous would be partial trees. So we'd have to generate either two different partial trees that generate the same string, or we'd have to generate two different legumes derivations, or two different marigose derivations. Either of those would show that it's ambiguous. Here we're showing that we can't just look one token ahead and figure out which rule to take. Okay, so this is with kind of the first rule we derive. So let's look at a different example. We have A is similar. A, little A, or epsilon. First steps again, our trusty friend, empty steps to start. Let's start with A here. First of A minus epsilon to A is nothing. First of epsilon is epsilon, so I get epsilon here. Then to S. First of A minus epsilon to S, what does that add to S's first step? Nothing. The first of A is the second tiny epsilon. We subtract out epsilon, and so we get rid of that so we have nothing to nothing. Then we say, does rule 4 apply? Yes. So then I add the first of little A to the first of S, and then do I go on anymore? Rule 4? No, there's nothing to go on to. And I ask if rule 5 applies, does epsilon in the first set of all the symbols here? No, it doesn't apply. Then let's go one more time. So here, so we actually already calculated this up here. So what's the first of big A and little A? A. A. And then the first of epsilon is epsilon, so I have A epsilon. Here, let's quickly. And then here the first of S is still going to be A. If we do this one more time, we'll get exactly the same results. Okay, so let's go back to our first rule. We have a rule A goes to alpha, and rule A goes to beta. And so we want to say the first of alpha intersect with the first of beta. So first of capital A, little A, intersect with the first of, what was this? Epsilon, which is the second to A epsilon. This is the empty set, right? Cool. So by this rule that we derived, we decided that there's no possible way or that we should be able to distinguish by looking one character ahead which of these rules to choose. So let's say, I got to zoom out a little bit, it's getting crazy, okay. Let's say that we are writing parse. Here we say our handy t-type is equal to get token. Now how do I distinguish between these two rules? Yeah, so let's do if, so if t-type equals A, then what does that mean you can do? We'll start with parse A right here, right? So this is the only thing we care about. Which one of these two rules do I have to do? Big A to little A? Leaving some stuff out and not writing real code here because we haven't gotten into all the details and finer points here. We're technically going to get a token in here. So let's think about this. So let's start this up. S. How many choices do we have here? Fun. We have A. So now here we have two choices. A little A or epsilon. So let's go A little A. And then this A little bit of epsilon. Cool, so what strength is this? So based on our code up here, we're trying to parse A. So we're trying to build this part of the tree. We call parse, we check. Yes, get token returned to little A. Great. Then call little A big A, right? Which is going to... So the first little A is going to parse here. Remember we did unget token because A is supposed to actually generate that A token. So our input is going to be here. Now when we call get token, what do we get? A little A, which causes us to try to be what? To parse a big A again, right? So when we see an A, which of these rules are we going to always choose? The first one. So why are we reading A for epsilon here? Because the rule here is A goes to epsilon. So the epsilon generates nothing. So then what are we actually reading when the rule produced an epsilon and we had A goes to epsilon? What are we actually reading? Where did this A come from? What was that? The next token. Whose next token? What's the next token? Where did it actually come from? Yeah, whatever... So we talked about first sets, right? Where first sets are all possible strings that that non-terminal generates. What is the first token or first character that those strings can end up with? But here, where did this A come from? Yeah, it came from because it comes after A, right? It came after A and because when A goes to epsilon, it went to nothing. Now whatever token we're reading comes from whatever is after A. So when we're here in parts A and we read an A character, or we get a token that returns A, do we know that it's because it's this A that was generated in this rule? Or was it perhaps because it's... So let's talk about another situation. So we look there.  So same thing, my resulting string is just A.  And then what? Based on the code we wrote here, I wouldn't say it's a parts A and then check a little A. But I would choose this rule. But once again, where did this A come from? It came from S, yes, it came from S's rule and it came because this little A follows the big A here in this rule S. So back to our original question, we pass this check, right? We have this check that says, hey, there's nothing in common between these two rules of whatever their first character is, but can I tell which of these rules to apply if S goes to big A, little A, or epsilon just based off one token? No, but the question is why? So what's special or different about this as opposed to the other grammars that we've seen? It's what? Same right hand side? So you mean the fact that this and this are the same? A, A, A. Oh, sorry, this is not the one. A, A, possibly. I could change it slightly. I mean, I could change this and mess it around, but it'll still work. Is our goal here given an input sequence of tokens to determine if we could derive that sequence of tokens using our contact programmer? Yes, we're going to construct a parse tree from the sequence of tokens that we're given. And the parse tree that corresponds to exactly two that generates that string. So A, the first thing is we need the language to be unambiguous. We need there to be only one parse tree for the thing we're talking about. But then the second challenge is can we do this by only looking at one token ahead to decide which rule to apply? So you think about it, when I'm drawing the tree, we're always starting from the top. And so I'm saying, okay, starting from the top with rule S, can I know by looking one token ahead which rule S goes to alpha or S goes to beta or S goes to delta? Or I don't know what you're talking about, but between all of those rules we want to know how to draw that first level of that tree. I think the first token from the input string we're comparing that with the first set of each of the rules, of each of the non-terminals in our grammar. Of all the rules that we have so like, exactly, with that left-hand side. So in the first case we're talking about parsing S. So we're starting with the root of the tree. And so we need, let's say we have rules of the form S goes to alpha S goes to beta S goes to delta for lack of a better term. We want to know by looking, so we've started our tree, our tree starts at S and it always starts at the top. So now we need to know just by, so we have some sequence of character of tokens. A, B, C, D, E, F, G. And just by peeking ahead at this one token which of these rules should it be S goes to alpha S goes to beta or S goes to gamma? Right. I asked that question earlier. So we have an unambiguous grammar with two rules of the same person. No, we don't know how to think. Correct. Yeah, so that's exactly where this rule comes in. Right? So this rule that we kind of derive basically says if we have two rules of the form A goes to alpha and A goes to beta then the first sets, the first of alpha, I guess I didn't write it all right here. First of alpha intersect with first of beta better give me the empty set. So this means by looking one token ahead I can decide between alpha, gamma, or delta which of these three rules applies? Yeah. Is not it the empty set is that unambiguous grammar? No. Not necessarily. So that was the question that I asked. Yes. Apparently if it's not the case that the set is empty then we need some other method to determine which rule we're going to use. Exactly. That's part of the problem. So the problem is in some cases like we just saw here, here I have a case where the intersection between alpha and beta is empty but still by looking one character, one token ahead I can't actually distinguish between these rules of A goes to big A little A or A goes to epsilon. So we're going to make a name for this in a second of what these rules are that we're deriving so that we can discuss between ambiguous and the thing we're talking about right now. In order to do this we have to develop a new type of function similar to first sets but we need to understand why we're doing this to understand the need for this. So in this case, this is not a good example because we already said we can't decide between them because the first sets are the same or the first sets do have an intersection. So let's look at a very quick see if we get into this problem again. So while I'm writing these if you want to practice on first sets policy first sets whatever feel free to use any of the grammars in here come back, look at them and calculate yourself to compare what we got in class that's always a good self-check mechanism. So we start with empty sets this will be B epsilon and so S will be B A So now we can do so by the rule of the guys okay the first of little B A little A the second containing B intersect that with the first of epsilon which is epsilon and that intersection is what? The empty set but nothing in common. So it passes over rule one. So then is it the case when we try to parse A we look one token ahead and we see a B can we determine between these two rules? Yes. Why? But in this case this first in this case they don't intersect but we decided we can't determine between these two rules right the first of big A little A as we calculated here is A A intersect of epsilon is the empty set and yet when we saw an A we didn't know we don't actually know which of these two rules applies maybe? Why do you think it has to do with epsilon? How does that change things? Because when we have a non-terminal it goes to epsilon it goes to nothing but we don't read nothing when we call getToken we have to actually read a token so let's draw a parse tree here I think this will help we have S goes to big A little A so we have two options here we have one here goes to epsilon and then we have S big A little A A here goes to B and here we have A go to epsilon so we have two strings right B, A, A and just the string A so as we said when we try to parse S S has no choice there's no choice we always know we need to parse big A and figure out how to check for this little A so all we care about is parsing this A so the question is here so in both cases I'm going to try to be here and try to parse little A and try to make the rest of this tree so I'm here I read one token ahead in this case it gives me B in this case it gives me A so based on that can I distinguish which of these two rules I choose reluctant yeses why? in the case of nothing what am I actually reading the next token what is the next token in this grammar what comes after A what do you mean for S I was talking about when this A goes to epsilon what are we going to read this after the little A that came from this rule here and when this A goes to epsilon what are we reading from this A that came after it because when we're trying to parse we've already parsed everything before it and so we'll read the next thing that comes after it if A goes to an epsilon so we have a B here so when we read when we're trying to parse A if we get a B token what does that mean yeah it has to be this first rule right it should be B A little A because we know if A went to epsilon what character should we be reading a small A because of everywhere that A appears in the grammar we know that if A went to nothing the next thing right after it is a little A so let's think about that we just did here and use that on our previous example so here what follows A what comes right after A in all the rules on the right hand side little A and A can go to epsilon we have a rule A goes to epsilon so when I read in an A which one of these two rules did it come from why can't we decide yeah it could come from the first rule because we calculated that the first of this rule is little A but in the case that big A went to epsilon it could also be any of these A's that came after the little A so we don't have a way to distinguish between these two cases because of how A is big A is used in the grammar and what comes after it still in the case where the intersection of the first sense is still empty yes so we have an intersection of the first sense is empty we still can't tell which rule it is exactly because of the nature of the rules because it really boils down to this epsilon because in the case of epsilon we get nothing in the output string that token that we read in did not come from A because A did not generate any output it didn't create any token there it went to nothing and so the question is essentially the question here is did A loop back on itself and call parse A again and generate another small A or is it done and did it go to nothing the problem is you can't tell if it went to nothing because there's the same characters that this string could generate the first of this string is what is also after A I think the grammar ambiguous I think this one probably would I'm sure you can come up with an example that is not ambiguous but has this problem anyways I think if I got rid of this A it would be not ambiguous but you still can't tell by looking one character ahead for the same reasons because you read a character one token you'll read an A you don't know just looking at one character ahead if you should stop in this case epsilon maybe you don't have this problem oh yeah because you got this A here you don't know if there's only one more A left or if there's going to be a bunch more A's left it's a good example let's walk through this bringing this I can just do S goes to S little A or epsilon so same thing so the first of S is what epsilon A so let's check our rule one so another question is this an ambiguous grammar give me a string that has two different parts trees A so I can generate A with S goes to S A goes to epsilon what's the other three S to what S to what so S to SA the only choice I have is SA S goes to epsilon so this generates the string A this generates the string AA right we need two different parts trees for the same string it says like sale so is it ambiguous no right because exactly how many times we apply this rule is how many A's are going to be in the grammar we have no other choices right we keep so this all this context we have described is all strings of zero length or one or more A's and for that entire length you just create and keep applying rule one until you're done and then apply rule two right there's no other choices there yes we're using we're using them interchangeably so well okay let's think about it in a couple different ways yes ultimately also in the context for grammar it's a terminal symbol which could be anything and here our terminal symbols are all characters and we're concatenating those characters together but yes ultimately we're using this to describe and find tokens so these will be our terminals will be tokens and the input is a series of tokens from the get token function to make it more confusing to get token function as we saw we'll try to look as head as many bytes as it can to find the longest token that it can return but then once it decides that it's done right we'll get token again epsilon is creating so many problems then why are we using it yeah I mean do you want to define languages where you like have to have something all the time I use it I guess if you didn't have rests in music it would just be sound for entire song yes that's a good analogy or you think about programming right think about an if-else structure right do you have to include the else clause by any time you use an if no but you can't use an else by itself because that doesn't make sense right so you have the option in some sense after you have an if to do an else right but you don't have to do it all the time but you better not have an if-else-else because that also doesn't make sense then you get to crazy things like if and then if-else and then if-else and then else right so you have any number of if-else's in there so yeah when you program you don't always want to have to do everything all the time then you couldn't even say things like I don't know and every function has to have one class it can't have zero classes you can't have zero imports you always have to have one import because of this epsilon problem how do you say that? epsilon helps the regression? yes I think so that's what I was going to say at the start but I don't know if that's true or not I don't like to say things that I don't know okay so we have a language here it's unambiguous it passes this test but the question is by looking one token ahead we know this is only a part strings of A's so I start at S I have this string A I call getToken that returns me one A which one of these do I choose? S-A or epsilon? in this case I choose S-A but why do you choose S-A? you're an algorithm you can only deal with the information you have you know that you read in the token you have no idea what comes after it so what made you make that decision? let's go back I'm going to change my style actually I think it's fine okay so the rule that we decided if we're reading A then it's got to be S goes to A but all valid strings that this language is going to produce or all sequences of tokens that this context through camera represents is all little A's so are you ever going to not read an A? so how do you know when you've reached the end? how do you choose S goes to epsilon? okay let's see if we run out of A's okay we start here, we read in one A we call ungetToken, we start here so now I read in another A I go here I call ungetToken I read in another A am I ever going to stop this? the problem is what comes after S in this rule? A and what's the first of essentially S lowercase A so in this if the left hand side rule applied we know the first is little A we're going to read in the little A for sure if this rule was applied but if this other rule was applied where did that token come from? if we chose this one where did that A actually come from? S from S A because A comes directly after S so the problem is we don't know when we're reading this A the fact that everywhere that S is used a little A can follow S right? and so now we're going to think about is we have first set so what does first set mean? all possible strings that this generates what does the first set mean? the very first whatever is the left most the first token that all possible strings generate and that's super useful because we need to be able to distinguish between these rules but if S can go to epsilon if you think about it S is a little tricky but we've already seen a recursive S so we know that S isn't the entire string the resulting string there could be other stuff after S so let's say S generates this string this part of the string and the question is what is the token that can come directly after S? so in all possible cases across all possible rules what's that token that character that can come directly after S? because if S goes to the empty string to epsilon then we must have read in this right? and so if I have the choice in S I have multiple different rules one of them has epsilon in its first set which means you can go to nothing and one of it obviously it does not well you have to assume that they do not because otherwise we find like a first rule if two rules can both go to epsilon then we already say no we can't do it by the first rule so we say we have A goes to alpha and A goes to beta and nothing in common but beta can go to epsilon and so this means that we actually want no intersection between the first set there and what follows right? the character that directly comes after it because if this is let's say B and this is an A this is the second containing B now when I read a character I'll know what is epsilon or does it instead go to this other rule to do that we're going to find a handy little function called follow where follow is what are all possible string tokens that can come after a non-term makes sense? intuitively not really intuitive but the fact that you've been sitting here listening for weeks you've developed some intuition about this right? so what this is saying if A can go to nothing then it better be the case that I can distinguish between the first of A intersect with the follow of A so that means that hey strings that I can create if there's ever an overlap here then I cannot distinguish based on looking one token ahead questions on this? sweet so now just like we did on first sets we need to define follow sets right? we need to define what do we actually mean what is this function so let's talk about it what's the input yeah how far? to what? so what's the first of what's the first of S little A I'm asking you now so the first of S is the first of S right the first of S is epsilon but why do we not include epsilon here? so one way to think about it and we didn't really talk about it we talked about how to do first sets we said there's sequence of characters one way to think about this this is completely equivalent to saying what's the first of B where B goes to S A taking that exact same thing in here so what's the first of B so S minus what? minus epsilon so it's A and then you say is there an epsilon in this first set? yes so we go on to the next one add the first of little A to the first of B so it's little A and then you say if I move on no there's no more because rule 4 applies are there epsilon in all the first sets? no there's not so I don't add epsilon here so that's why you get A for this one intersect with here it's clearly epsilon so this is just essentially a shorthand or a different way to think about doing this so we wanted to find this follow function when we define functions what do we want to think about inputs and outputs so what's an input to this function? yeah so for right now in the other one we talked about sequences of characters or sequences of terminals non-terminals here we only care about non-terminals alright so it takes a non-terminals input then what's the output? terminals yeah so it's going to be a set of terminals and let's think about this so first sets the output is what? terminals and epsilon so is epsilon going to be in our follow set? no right and but it comes from the definition here we want what is the characters the things that the terminals that can come after S is produced right in the resulting string epsilon is never going to get produced in the resulting string therefore it doesn't make sense to talk about epsilon here so there's no epsilon in follow sets and this is something you can use to essentially type check your work while you're doing it if you're calculating follow sets by hand and you get an epsilon in your follow sets you're doing something wrong let's think about this what's the follow of S? what comes after the S? let's try to treat it S A right so we want S produces this whole thing so we want what comes after it where are we in our input string? end of file end of file we've got all the way to end of the string so if we're here and we call getToken it's going to return end of file now this is actually really good so on Friday we're going to go through all the calculations for follow sets and we're going to take your first set so we're going to develop the rules