 All right, can you guys hear me in the back? Yeah, okay. Thank you. Thank you for that amazingly upbeat introduction. I really appreciate that So just to make sure I'm in the right place that you're in the right place. This is the room for CSE 340 Yes, most of people nod some people leave. That's fine principles of programming language Okay, so first things first For those that don't know me, which is probably the majority of you. I'm Adam DuPay This is my first undergrad class. I'm teaching here at ASU. So I'm pretty stoked about that I hope you guys are excited about that because I think we'll have a good time a little bit about my background. I did Five years at UCSB where I did my undergrad and grad kind of like the five plus one Or what do you call it here or four plus one? Yeah, so that's similar program then I went to Microsoft or I worked full-time as a software developer there doing coding stuff And I decided that I really really really like doing research So I went back to Santa Barbara to do my PhD and there I work on I worked on Security research so automatically finding vulnerabilities in specifically web applications So through static analysis techniques or some dynamic analysis techniques And so that's really my research focused and that's why I'm actually really excited to be teaching this class because this Compilers and the principles of programming language really form the basis for a lot of the bug-finding stuff that I do so if you can Using the exact same techniques. We're gonna kind of learn about in this class. We can actually Try to find and identify vulnerabilities in a program without even executing it Okay, so before I continue questions about me my background Yeah What languages that I use in Microsoft? My team it was all I think all C sharp. I want to say So yeah, the app I was working in was written in C sharp Which is actually a really fun kind of cool language. It's like Java, but I feel like better It's like if they actually designed designed Java to be useful. So I said out loud in front of a bunch of people, okay That's fine. Cool. Any other questions? So I'd be happy to talk to you Later on whatever as interviews come up. You want some Feedback or some tips on how to do interviews. I'd be happy to help you there More questions. There's plenty of spots people in the back. There's lots of seats. We have a lot of people enrolled So I'd say the limit is 250 on the room. Yeah, I think it does. All right Maybe we can fit 10 more people in here Okay, so this course 340 This is the syllabus. There's a link to it on my ASU. You can also get to it from going to my website I'm dupe.com click teaching classes. It's pretty easy. I have to assume at this point everyone knows how to surf the web Use a web browser So We meet Monday Wednesday 2 30 my office hours are here. I have three hours of office hours a week You can also email me for appointments. I don't think you need to take a picture unless something's important. It's happening That is all on the web. It's all public just FY The course we have a course mailing list which I'll get to in a second the lead TA for the course Mohsen He's gonna be in charge of the homework the project submission system He couldn't be here today. So you'll get to meet him and see his face on Wednesday That our other TA sigh is here. He's the one who got me lost today. That's why we're late So sigh waves of the class. Yes. Okay, so sigh also has three hours of office hours a week Monday Wednesday Friday Your office we need to find you a place, but it will be in brickyard close-ish to my desk and Mohsen has four hours of office hours a week. So Together somebody who's really good at math. What is that? 16 33 and 4 is 10 10 10 guys, I know it's the first day, but you know, you can wake up a little bit Yeah, so we have 10 hours of office hours a week. So please come and talk to us So that's basically what this section is about. So we've tried to distribute it Throughout at all days of the week. There will be office hours some in the morning some in the afternoon If you can't make those times Talk to us email us. We'll also communicate with you if we have to change or move around office hours schedule What we expect from you we expect that you'll actually have Done some work or some prep when you come into our office hours. You just come in and say why don't understand problem Too on the homework Well, that sucks. Okay. What did you what actually don't you understand? What have you tried solving? What ways have you tried solving it? What didn't work? that shows us that you put the time in to think about it and That means we can help you more effectively. So it'll greatly help all of our times So yeah, that's basically this is about And if you have questions about the programming projects We also expect that you've made an effort if you come in and say I don't know what this error message is And I Google that error message and the first result tells me exactly how to fix your problem That you did not do sufficient research to understand that problem. Okay, then I'm gonna I don't know what I'll do But don't do that Because that's silly right if you can help yourself. That's awesome If you can't and you're stuck with and ran out of options. We're happy to help you out Questions office hours basic stuff You guys have to like raise your hands up really high too. It's Difficult to see all right So all the communication for this class is going to happen over This web page and a mailing list. So I'm not gonna have a blackboard site most likely Because I feel like this is a lot easier and a lot more maintainable so So part of your first assignment will be to sign up for the course mailing list So the ta's and I will make announcements to the mailing list you guys can ask questions to the mailing list Obviously, I love it if you guys help each other out because this is going to be a very difficult course. So I am Very happy if somebody has a question. Hey this you know, I'm getting this Whatever weird obscure compile error and I've looked at Google and I can't find any reference to it Does anybody know what's going on and somebody else says oh, yeah, I had that same problem The problem is you're compiling 64 bits instead of 32 bits or something weird, right? So tried to leading this file and recompiling that's totally fine But if you send somebody code and be like oh this code solves your problem, right? That's a violation of academic integrity and that's gonna be very bad. It's gonna make me be mean and I don't really want to be mean So there's a great link here advise everybody to read this article I'm gonna test the Wi-Fi to see if the Wi-Fi works. Yes, it does. Okay. How to ask questions the smart way It's a fantastic essay that will tell you exactly What we're looking for to help answer your questions effectively it basically boils down to what I've been talking about so Do your homework before you ask questions if you just ask thought thought list questions without doing any work or effort or looking at things yourself then I Mean we'll help you because that's what we're here to do But it's not gonna be a good good way to spend all of our time Da-da-da oh and sometimes so if you email us you're feel free to email us directly obviously if there's something sensitive But be advised that when we reply we will often times reply to the whole mailing list because this helps cut down on questions that everybody has questions Course communication Cool. Okay, pre-rex. That should be fine. Everyone here is past that. Okay the textbook So I have a link on here the bookstore should be either today or tomorrow having the textbooks I don't know if they do or not It's recommended. So this is actually the second edition. This is the one I have It's a lot a lot cheaper than the third edition so keep that in mind and the content from there is going to be Very much the same so what I'm going to do is I'm going to give pointers to the book of the stuff We cover in class, but I'm not going to sign any reading out of the book So you can use that as a supplemental to help you understand the material better That makes sense Cool. All right so This is the calendar of the course events Some things will notice on there that we'll talk about the first project is doing a week. Yeah. Yes, you can go to You go to my website teaching classes. It's right here. It's linked to the syllabus. It's also in my ASU There's that syllabus link that goes right to this page So yeah Cool. Okay, so things on here. There's midterms exam scheduled so look over this make sure you understand We're having a midterm on the 30th Then we're gonna have our next midterm on the 18th and the final exam is gonna be on the 7th So the exam dates are fixed If you have anything in accordance to any of the policies or whatever come talk to me Questions, okay, we get to the fun part. So this is gonna be a difficult class So I'm not going to lie to you and tell you that's gonna be easy You're gonna have to work really hard in this class Especially if you don't have strong programming skills So all of the projects in this class are gonna be in C and C plus plus and you're gonna be writing big projects that are complex and they're going to challenge you hopefully in good ways, but I Think it's you're gonna have to understand new abstract concepts that we talked about in class You're gonna have to understand new programming completely new ways of thinking about programming and you're gonna have to implement complex systems So if you don't think your skills are up to snuff, then I would say take this course another semester maybe Questions there's lots of people scratching their heads. Yeah, got it Okay, there's gonna be six written homework assignments They'll go over the course the concepts covered in class. They will also help you with the exams So the stuff on the exams will be in similar formats for the homeworks Two midterms, so I'm gonna say this now. I know I'm gonna have to say it later, but Everything it could potentially be on any mid-term midterm or the final okay, so Asking is this gonna be on the exam is a silly question because the answer is yes And the more questions I get about that maybe the more I put something on the exam that would be asked more so Just so we're we've we've gone over this we're clear. All right programming projects There's gonna be five programming projects the first two are gonna be very well the first one should be very very easy We'll talk about it in a second But they get More and more complex So all projects are gonna be done individually so there's gonna be no pair programming no teaming up This is something that you're gonna have to figure out and solve on your own All right, that's gonna be a final exam comprehensive cover all the materials cool It's the breakdown of grades can somebody who got the first answer to make sure that that lines up to a hundred It does I got at least one verification good Otherwise you guys just lose those points Okay preliminary grade thresholds, so This is right now what I'm gonna put them as So it means obviously if you get above that threshold you get that grade. I May I mean it all depends on how this course goes. I may Lower those thresholds, right? I may make an a b. I don't know 92 or 91 percent It all depends on how everything falls, but I won't go up Okay, that makes sense. I won't get it. I won't make it more difficult to get one of these grades, so Let's have an example. So if you get a 90% right that's guaranteed at least an a-minus it could be an a depending if I have to go down and Make everything match up. Does that make sense? Okay Do you have questions raise your hand? We're all friends here. It's okay. Yeah Are there gonna be any quizzes? No, maybe I don't know No, no, it'll be what's on the what's on here. I Won't try I won't try to throw any curveballs Okay Homework due dates homework or due online by midnight on the date that is due I'll have a link when I release the first homework assignment will release how to submit the homework No late homework is accepted. So don't try don't ask Projects projects will each have a date and Exact time that they're due for each day that it's late It's gonna be a 30% is gonna be taken off of whatever grade that you get So even if you complete the project 100% if you submit it a day late the motion get is 70 And it goes down 30% day after day I think it's pretty clear Yeah, depends on what reason they give if it's 11 59 59 It also depends on why like if you're these are gonna be big projects. So if you're really going up against the wire here You're not gonna be successful. So you should not be doing that Though submit early The you'll have feedback right away that tells you that this was right or not, right? And so then you can use to know in advance Yes, absolutely. Yes, I believe I'll check with Mohsen because he's in charge of that system But I believe it's unlimited submissions So you can keep submitting but obviously Don't like go make a change Submit it and then be like oh it doesn't compile because I forgot to actually compile it on my own computer before submitting it Right, so don't use it as an oracle, but yes, there's a hand over here Yeah, yes, there will be well. I'll show you in a second. Actually about that assuming everything works more questions So maybe as you can tell by well actually probably only these people can see maybe you people I'm gonna try to record all the lectures in class because I know whatever your schedule You can't make it and you have to ask me what's gonna be covered So I'm gonna try to record the audio and the screen here So you get to know what we talked about in class and I'll try to post these but this is not guaranteed so You're all adults. You're responsible for the material covered in class If I forget this thing, I'm not gonna stress out about it and record another lecture for people who weren't here I'm just gonna lecture so, you know, it's And I'll post the slides all the notes as much material as I can and pointers to the book Questions any extra credit? Probably not I'd say no at this point unless like So, I mean this time the projects are gonna be already hard enough. I don't know that having extra credit It's gonna be good a good thing So I'd say no at this point. That's why I would the a plus is at 97, right? All right cell phones put your cell phones on vibrate or silent. I feel like that's should be pretty easy If you need any special accommodations, let me know we can talk about this Okay, this one is very important. So I'd like everybody To pay attention and listen I take plagiarism and cheating very seriously. So part of what you're getting out of this class is the ability to create a complex interesting System and so by plagiarizing somebody else's code or helping somebody plagiarize That's to me like one of the worst things you could do. Just take the zero I've already caught a Number of people cheating and I don't want to catch any more It's a lot of work for me It's a lot of work for the TAs, but I'm happy to do that because I think it's fair to everyone else Who's actually putting in the effort so if you're Sitting there and it's 10 minutes to the deadline. You're like, oh, I don't have it quite But oh my buddy's got everything all finished if I just like oh Man, they'll never notice we will find it You'll get a zero on the assignment and a letter grade docked in the course It'll get reported up to the Dean's office. So they keep a record of it. If it happens again, you get like Very serious things happen. So So I don't want any of you to be be like that so come talk to us if you're having problems Come to us, you know, we find you cheating and you go. Ah, well, it was just so hard Yeah, okay. It was hard, but you never came to office hours to talk to us Or you never asked any questions on the mailing list So it's really up to you to monitor that some examples Sharing code with a fellow student even if it's a few lines Collaborating on code with a fellow student. So even if you both worked really really hard on it together That's not a good excuse. It's still plagiarism Submitting another student's code as your own I should be that should be pretty obvious Submitting a prior students code as your own also plagiarism Okay, and this is something I do have to cover so, you know, please do not post your projects online I know for a lot of you you want to build up an online resume for employers So they can see the stuff that you've done in class and they can hopefully give you a job and they can see What an awesome coder you are. I'm here to tell you I've like worked in industry Everybody takes classes and does class assignments Right, so the best way to get noticed is to do something outside of class something different So instead of thinking hey, maybe I should post this project on my github Think hey, I'm going to Create some new cool thing that's related to that some interesting type system that we didn't even talk about and I'm gonna put That on github because employers are gonna love they seriously eat that stuff up and feel oh, yeah That website on my github. Yeah, I created that in my free time. I'm like a hundred people use it They go wow people don't do that They just do the bare minimum in class and you went above and beyond So because it it really hurts the other students it resists it takes away that temptation for students to Google CSE 340 project to and find a bunch of stuff right so Protect your fellow students protect yourself Don't post your cook don't post your code from this class online any questions about the plagiarism and academic integrity policy Yes So using code from yeah, so if you use code from other sources like stack overflow or even If you find a library function or a library from somewhere else I'm totally fine you can include that but you have to include the attribution right so in your comments It should say hey, I got this code from this stack overflow thing, you know if it's something small I think that's fine right if you happen to find something that does exactly what we're talking about in here And you say this entire code came from stack overflow. Well, great. It's not like I mean It's not plagiarism, but then you did nothing right it'd be like in an English class Submitting an essay as a Wikipedia article and saying the Wikipedia article on ethics says this right? It's not plagiarism because you attributed the source, but you also didn't do anything So that's my policy there. Yeah it Is that's true and but I'm expressly forbidding that I'm saying no because then you're Yeah, it's one thing if you find one thing online right that somebody else wrote in another context. That's helpful for you It's something completely different if you're both working towards the same goal and you go Oh, hey, look at that awesome function. You wrote to do that. I'm gonna not write that Yeah, I mean from using from somebody else Yeah, yeah, I would say yeah, you know use your judgment if you look I mean If you're looking at it and going man, this is the entire project don't use that right or if it's but if it's But you should also understand how that code works too, right? If you just you don't want to be one of those copy-paste coders who just like goes to random websites literally when I was working in Microsoft I was One of the product that we were working on we're making an XML based tree So you could like click on the link in this tree and then it would point in the document where you were And so I was tasked to like we need to improve this it sucks So I started looking at the code and I was like, how do you do one of these like trees? So I looked it up and I'm reading this like I think it was one of those code Academy No, that's not the right word but one of those like C sharp Programmers things and I go huh these these variable names are very familiar and I go look in the code And it was the exact same thing That somebody had posted to the site and it's not like Stack Overflow where they give you license to use that thing Right, so the Stack Overflow has the I think it's the Creative Commons license on all this stuff there This was somebody's proprietary blog where there was no copyright on the code in our product So as soon as I told my manager that we had to like rip it out and completely re-implement it So yeah, that's like it is literally a liability to your company for you to do that So yeah, don't you know understand things And if you have any questions ask that's the other thing, right? So if you're thinking about using something and saying ooh, I don't know where this falls ask I'll be happy to to let everyone know Questions Yeah, I mean we can be honest We're not like it's not in the back in the days where we didn't have internet where all we had was like a both to look at right? So there's a lot of resources out there. Help yourself educate yourself But know what you're doing Okay, and I could change the syllabus if stuff has to happen Kind of standard claim disclaimer. Anybody have any questions on the syllabus? Anything there? Can you oh should you? No, no I don't know I was gonna say maybe if you're really short and you can't see over the person in front of you You could use it, but it's not that big so I would say no don't I wouldn't bring your book to class Do you have to bring books to a lot of classes? No, okay, just curious more questions All right, so let's look at the first project See if a week to do this project It's two parts first part sign up for the course mailing list So do that put your ASU ID. I don't care what email you use whatever Doesn't matter to me. Just sign up before next Monday to get 10 points Right pretty easy Good Okay, so the other part is right a So this is what I say. This is an easy programming assignment. It should be so write in C or C plus plus a Slightly advanced hella world application You're gonna write a program that reads from standard in a string an integer and Then your program is going to output that many times the string hella world with a new line So example if your program is given an input of one to standard in you output hella world and you're outputting Hella world with a slash n the new line character not so output of just hella world is Not correct because it lacks the trailing new line Hello, this one is not correct Because there's multiple spaces here, right? It's kind of hard to see in HTML, but that's also not correct This hella world is also not correct. There's no space in between the hella world and there's also not a new line This is also not correct hella world slash r slash n because the new line character is only slash n So you maybe think of yourself man, that sounds crazy. Why would we be so strict on this? And the reason is well, you got to start thinking like the computer, right? So what happens if you've got a semi colon in your program? Huh, yeah, the line ends your program crashes. It won't compile. It doesn't do anything, right? You made one mistake one little error, but the whole thing doesn't work so that's the same thing here so you have to get in the habit of Implementing exactly the specification that we give you and that's why we have this very small practice homework Okay, so yeah, if you're given the input of five you will let's make sure I do this one two three four five Yeah, okay, so five hella worlds All right, so hopefully this works Okay, so that link there will take you to the link to the submission the project submission site The URL is I don't know CSE 3 for CSE 340 dot Fulton dot esu ASU dot edu. I don't know why these things are so long But they are Let's see you will click here to register Mosin will be emailing everyone very shortly your verification code To your ASU account that's affiliated with the school So you just put in all your information here You can log in I go back I See the problem here All right, well This is when you break your rule about not using your own web browser Okay, so last pass knows my password. I don't even know my password. So I type log in and I sign into 340 And tells me these are the list of projects then in here I can look at the make file So this will actually help me compile my code and this is the exact make file that Mosin system uses to compile your code a test script to test your code a zip file with some test cases and this awesome Programming projects guide which I think well So Mosin lead TA wrote this awesome guide about how to program projects for 340 so this is 12 pages so It tells you about all the test cases it tells you how the test cases are run It shows you that there is no room for error on the outputs It shows talks to you about Input output redirection so you can run to develop your own test cases She's got an example here The test script that you have for grading Let's go to okay the development tool. So this is really important. So you know to make sure that we can compile your code and That you can compile your code. We're standardizing on sent OS 6.7. Yeah, there's a question from the front Do you know I see a hand on my eye? Okay So this is the same I believe this is the same version that general dot ASU uses So if you want to use that for development purposes you can it's also the same thing That's on the second floor in the brickyard those computers in there. The easiest thing to do is to Where is it Okay, it talks about make files installing sent OS on a virtual machine So there's all the instructions everything here is free. You can have sent OS running on a machine here Just like I do Hopefully if I click this it'll work and everything won't die So literally I installed this just by following those exact same instructions So now I have if this ever boots up a machine where I can compile on and that version of GCC that I'm using here Is the exact same thing on the submission system? So that when I go to submit my project I can make sure that it's correct. So yeah, there's all the instructions you need and So now I can submit Let's see teaching projects I Can submit my hello example Submit it and says hey past two tests out of two yay a hundred percent awesome And I can look at all my submissions and it gives me like some of the output All that stuff so the big part about project one should not be the programming so let me go back to the The thing here So the programming on this project is intentionally meant to be very easy The real goal here is to familiarize yourself with the submission process so that when we start having complex Programming projects, you'll know how to submit to the system. Yeah, what are what instructions? Oh? Right so So there's a link on Yeah, so on the projects page There's a link to these guidelines so you can even get to them without Worrying about the course submission thing and then most then we'll be sending emails with that verification code that you need to Create an account on the turn in system. Yeah maybe So I would say probably not so we will go off the test cases We may for various projects have the graders and TAs go through and look at them Just so that we can I don't know if you somehow hard-coded the test cases or something We could give you some feedback and reduce your score But yeah, you know that would be kind of mean so I probably wouldn't do that unless it turns out we need to Any other questions so okay, so back to the note so If this assignment takes you like Significantly longer than on the order of an hour you should seriously consider about not taking this class and taking it some other time The submission stuff, okay, maybe but This is a slightly more advanced hello world and if you can't do that you're gonna have serious problems doing the programming assignments So consider this kind of a self-check before we start Other questions on the assignment the submission system. Yeah So this is the requirement your code has to run on sent os 6.7 on our submission server If it doesn't then you might as well not do anything so If you're willing to develop it in visual studio and then Make sure and get that code working on sent os 6 7 with the exact version of GCC that we're using That is fine, but No, you're taking a risk by doing that So that's why we have this standardized system so that we can make sure that everybody's using the same thing That way because what happens is you submit it doesn't work then you say ah, but it works on my computer, right? That's like the classic Anybody doing an internship is like a tester or something like that Some people yes, that's like the classic dev thing like ah well it works on my machine So yeah, but it doesn't work in production. So your code is crappy and it doesn't work So Like go fix your code So we want to avoid those issues and get you in the habit of getting on a standard and doing Everything the same. Yeah, so yeah os x is a little bit tricky So I mean I developed this little application in os x with I think actually the newest versions don't even have actual GCC I think it's linked to clang. So you definitely could run into problems there. So that's why I installed I Installed sent os. I mean, it's not very big. It's kind of small and Honestly like a lot like you should be getting very familiar with Linux these days That's also a selling point to employers is saying like hey, I have a Linux system on my box I know how to configure it. I know how to use it. I know how to compile on it. Like that's good Yeah, there's other questions hands. Yeah, I send us a link. I mean You can use a VMWare. I think they have a free version on On all the platforms except for this one So yeah, either virtual box on The Mac or VMWare on Windows. That's what I'd say consent os compile C plus plus 14 I have no idea you'd have to look at the version of the compiler for that So if you want to use anything special like that, then you can change your make files so that you're using whatever compiler flag Do you need for that? But if it's not on that that system then don't count on it also related to that if it turns out it's somehow Technically physically impossible for you to get a VM running on your system Tell me and we can find a system for you to be on Because yeah, you should also have general I think general should work to or the lab machines a lot of choices more questions Yeah, you can resubmit it. It's got to work on the machine So the question comes down to is why doesn't it work? So if you if you have the code in your computer You say it works you submit it to the thing and then you wait till the deadline expires and you go Ah, but it worked on my machine, you know, and it turns out there's some you made actually a technical error And you I've I've had this happen where people submit the version on their Windows machine when they've been testing on their The Linux VM and of course that one doesn't work on On our Linux servers, so it was a problem on their part So that's kind of also a good point that's in that essay that I sent out So assume that the bug is in your code first come to us and show us that you've like That it actually is a bug in our code With the submission system and you can send that to us and we'll try and fix it more questions You didn't think that was all we were going to do today. Did you? Yeah Yeah, so that's that's the big thing especially with Windows and Linux That's why I say probably don't develop in Windows because the default line endings there are I think slash r slash n and The default line endings and Linux is slash n so oftentimes you can completely mess things up If you submit what it looks like identical versions So you can use a hex editor. There's a tool hex dump. I think HD is installed by default on Linux things You can look at the raw bytes and see like those aren't like an OA and OA like they should be at the end Well, that's why you have a lot I would say you should start you got to start early So you don't want to wait on these assignments submit and that way you can You can verify so the golden standard is right you you test it on a cent OS 6 7 machine It compiles there you submit exactly that version onto the submission site and then if it doesn't work Then we have problems, but if it that should work More questions Yeah, yes, so the slides we posted the lecture The lecture recordings will be posted Also some notes that I have from dr. Basi will also be posted so should be Ample material plus links to book stuff and the questions before we get started Is this the classic keep asking questions about the syllabus so we don't have to do any lecture stuff I know these tricks and if that's not these things. I'm saying are not the case then let me know because Mohsen has maintained this system. He's been using it for a long time. So He has a lot more experience with this submission system. So if there are things like that that we can improve I think we're happy to do that Anything else? Okay. Oh, yeah, so comment about the notes. Yeah, so, you know You're you're all adults here. I have to assume right so It's up to you whether you take notes in class or you just listen or I don't care. Whatever. Whatever you want to do is fine I'm not gonna force anything on you So I wanted to kind of start This class off. Yeah Yes, the lecture slides will absolutely be online. Yes, and if they're not let me know, but I'll wait until I'm done with the whole topic before submitting it online, right? I'm not gonna do it like piecemeal So yeah, so after these slides are done. We'll post those after the next Lexical analysis slides are done. I'll post those. Yeah, it's a good question. Um, I'd say no Especially So I'll be using some slightly different terminology. I mean in general. Yes, the ideas and concepts are very similar I'm not following the book chapter for chapter though And there's things we're definitely going to talk about in class that are absolutely not in the book because they're kind of advanced and really cool So the slides are good for that there'll also be notes For those yeah, try maybe in the future, but we'll see You know you like to make improvements and changes and stuff even like right before so Okay, so what is a programming language? This is not a rhetorical question. I'm asking what so I think most people are like Junior-ish area right junior senior somewhere in there, right? You've been at this kind of a long time So you've been doing this right? What is a programming language? Yeah, it's pretty good a much more. Yeah Much more readable interface to tell the computer what to do besides giving it ones and zeros. Yeah, that's good anything else Yeah, so some well-defined syntax and semantics. We're gonna get all into that Yeah, I kind of like it's a way to communicate instructions to a machine, right? So that's very similar to that example So we want to tell the computer what to do But is that the only definition and here? I think definition may be a little tricky But what's the other purpose of a program or a programming language? Yeah, yeah, so other people can interpret and read your work. I'd say that that's almost Honestly, once you leave academia and you go into industry you're gonna spend a lot more time reading other people's code and Cursing them that they wrote this code in this way Until you finally realize oh they did it because they had all these other constraints that I couldn't think about and then Hopefully you'll start writing your code in a way that future you in a year or two years from now When you have to fix a bug there, you'll be able to actually do it. So yeah, that's definitely one of them I think it's it's not even it doesn't have anything to do with the computer at all, right? You're communicating to your teammates future developers People that may use your library. You're telling them What this system or process should work? any other kind of Uses sort of communicating an algorithm Right, so you may not care that I mean you guys have all taken Data structures and algorithms right so oftentimes you look at things there. That's you know pseudo code, right? It's not it's not even to describe Instructions to another person, but it's to describe how an algorithm works operates all that kind of things Describing some sort of process it may not necessarily be an algorithm But it may be okay do this take this thing put it over here wait 30 seconds Call Google get the response from Google put that that in here mix it around and throw it in here Right that could be some kind of process that the program the programming language describes We talked about this communicating a system to another person This is I I will say this is a very important point that you want to keep in mind as you go because It comes up a lot oftentimes you think you're not actually Writing talking to the computer you're talking to future people So kind of already alluded to how does the computer understand your C or Java or Python code? Is it magic? Yes, it's all magic you just like throw together Random things and you've learned through trial and error and probably lots of error like in my case What compiles what doesn't compile and at some point like magically executes, right? So answer that is no, it's not magic, right? There's nothing magic here, and that's honestly why I love Computer science and computer engineering all this stuff right because you're learning how the whole thing works And that's part of what this class is designed to do is we're gonna peel back that curtain and realize oh, it's just Programs and algorithms all the way down right from that your Python code gets interpreted by a Python interpreter Which was written in C and compiled by a compiler to assembly code And that's interpreting your Python program and executing it and doing what you want it to do But you feel like hey, I'm just programming a Python program So we talked about this you kind of gave away my awesome graphic so the CPU understands assembly instructions, right? So that little hardware chip Needs and I guess this should be like a square or something that ship understands assembly language like ones and zeros, right and so But I don't know about you But it would be incredibly tedious to program with a keyboard But just like a bunch of one one one zero zero one zero zero you can do it I've you know, I've done some stuff for you like patch binaries to try to fix vulnerabilities and so you have to like look at the Assembly code and be like oh if I change that eight to a nine It'll flip and be instead of an if greater than it'll be an if less than which means that it skips this condition But you don't want it you don't want to program in that right? So we want some Abstraction away from the machine and so then once we start building these abstractions we build and build and build So yeah, this is kind of I talked about earlier so programs right it's all programs programs translate Your intentions what you the programmer want to have happen Into assembly language that the CPU understands So there's a couple of these can we go over to find some terminology so compilers Maybe we want to take a stab at defining what a compiler is Everybody looks away from my gaze. Yeah Yeah, turns it into Stuff that's very general. It's probably so general. It's correct. Yeah, I'd probably say It's kind of got a strict definition generally I like the more general definition of a compiler where it just translates from one thing to another right so See program to an executable It's becoming more often now that people have a very narrow definition of what a compiler is like a compiler Translates a programming language to an executable binary What about an interpreter? Translates one language into another I would say no Been close line by line. What does that mean? I can't see okay. What doesn't take the whole program at once Maybe what was that? Wait, sorry. Sorry. Yeah, doesn't convert the program to bytecode Yeah, I'd say that's That's almost there. It's getting closer. Yeah Wait, just like just like now we're getting into crazy semantics. Is the virtual scene for Java an interpreter? Maybe I'll talk about that in a second kind of What so yeah? right, so So yeah, I'd say an interpreter translates and executes. I miss missing some s's but translates and executes a programming language So it Understands it right it does that part of the compiler, but then it actually does the computation itself. So Yeah, is the so yes the JVM is an interpreter So the Java compiler does what the Java C. What does it take in? Go on so the Java compiler with a take in Java and what does it spit out? bytecode Java bytecode right JVM bytecode so in the JVM. What does the JVM take in? Takes in bytecode and then it executes. I wouldn't say it outputs right because we don't know if it ever outputs But yeah, so it does some computation. So yeah, those are where those two lie But what a transpiler actually I'll be honest. I hate this word But people actually do use it. So that's why I'm making a separate Category for it. And we want to get a stab at what this means. Yeah, perfect. Yeah So this translates a pro one program language to another programming language Anybody know of any good examples of transpilers? Wait, just like oh nice. So a matlab to python compiler. Yeah, that's cool. Yeah What is it? Oh jiphon. Yeah. Yeah. Yeah Yeah, I'm Trying to think about it. Yeah, you could say yeah, so it does compile Python. Well Maybe I'd say that's more of a compiler because it's compiling it does it compile it to the bytecode Okay. Yeah, we're kind of splitting weird hairs here That's why I don't like any of these definitions because to me those are all compilers but compilers translate. Yeah, I would absolutely think that counts. Yeah, yeah Exactly. So the Python 2 to 3 compiler right is an automatic program that converts from Python 2 to Python 3 Yeah, so Python 2 program isn't necessarily a Python 3 program. So they are different languages. Yeah Anything else? Anybody know of any of the crazy JavaScript stuff? I like what was it? I can't you got to raise your hand. This is the Acoustics here are super weird. You sound like you're coming from everywhere at once. Yeah What does Babel do? Ah, okay. So oh so it down converts. So it basically adds in the Non-existing language features to support backwards compatibility. That's cool Absolutely. I think those things see that's why I think these are so important So I consider all those compilers you can split hairs of compilers transpilers But yeah, so those are things that people may not think about so being able to translate from like Sass was that the one sass to CSS so like the compiler there, right? So that's a better way of doing CSS because you're gonna sign variables you can have inheritance all this cool stuff that makes see a Cascading style sheets super difficult to program in and they said hey We can write this awesome cool language to actually help us do that and make it easier to write CSS What about is it closure script one of the JavaScript ones that has this like completely different syntax But it compiles the JavaScript Rhino for Java. What is that? Java oh Java to JavaScript. Yeah, and Google has something similar right with GWT the Google web toolkit that takes a Java program that describes a web page and compiles it to JavaScript yeah, so This is part of what I want to get across is that like the stuff that we're learning is how to do all these Build all these tools because oftentimes it is the best tool for the job to say hey, you know what man CSS is terrible. I wish there was something better. Hey, I can create something better using the things I learned in 340 to take in a new awesome language and spit out CSS So cool stuff So yeah, that's what so it leaves me in right here. So we're gonna study how These programs the compilers transpilers interpreters are able to translate a high-level program language into something that a computer can understand and so to do this you got to know we're We're gonna be talking about two different things here and so this is also why I really really like this class because We talk about some of the theory stuff, right? So why do we care about theory? I know this is kind of a leading question. So I'll take it. It's like We don't care said someone Yeah, well, we do kind of care, but why why do we care? So assuming we care? Why? You answer a lot. I'm gonna go somebody else no offense Yeah It makes this makes you better in what way better humans better programmers I'd say that's definitely true. Yeah, let's go here Yeah, so it gives you the framework. So yeah, that's really good. So yes, it'll make you a better Well, I don't know if directly it'll make you a better programmer. I don't know that you go man I know the formalism behind regular expressions. I'm amazing But I think it helps you Think about those things and specifically I think in this context It helps us to define what we can and can't do When defining or creating a programming language or something we want to interpret or compile, right? So without the theory we just say You'd say well before this took this class You'd probably never hope maybe never think of ever creating a compiler or translator or programming language But after this class you're like hey, that's not magic. I know how those things work I can do my own thing But man this theory helps me know what I can actually do and what I can't do And how I should actually design my language So I can't talk about this. So yeah, there's all kinds of things. So anybody Here of the company called fog Creek software Yeah, some people can raise your hand so people don't think that I'm just crazy. Okay, good So their company anybody actually worked for them. That'd be a long shot, but okay So their company New York they make I think their big thing now is bug tracking software. I want to say and so they For a long time had this big application Written in I think like visual basic which whose programming visual basic Yeah, like one of the worst languages known to man Or maybe you like it. I don't know but My opinion is I do not like visual basic, but they wrote this huge application But their clients kept demanding like we want a PHP You know we we want to host it ourselves and we want to run it on PHP So they have a lot of smart people there They said wow it would be really terrible for us to maintain two versions of this application, right the PHP version and the Visual basic version then when we have bugs in one we have to make sure we fix it in the other and we have To duplicate our test cases. It's gonna be a nightmare. So they actually wrote a Language to compile from I think visual basic to PHP And then they started like improving it and ended up creating their own language to write the web application in and that Allowed them actually to then go from like From their crazy language to now. I think they've completely moved to C sharp So all that was like compilers at each stage Translating and improving for business purposes because it made sense And so yeah, so these you know these are the skills that Are very important and they are powerful and I think they do make you a better programmer Maybe not in your day-to-day, but that time that you're like wow I can create a compiler here This is gonna be awesome And it's gonna save me and this company so much time then you go to your boss and say hey I just saved the company millions of dollars a week. How about a raise? And then it'll be good for everyone Okay, so now I want to talk about some programming languages. So what is this? We can use abbreviations or acronyms for this specific language So for those that haven't seen it before I mean does this look like any programming language that you've ever used or programmed in Yes, you've used this. What's the biggest BF program you've written? Okay, so about this size then Okay So I didn't even write this I stole it offline So yeah, so this is a programming language called I'll shorten it to BF. You can look it up afterwards running this program in a BF interpreter outputs hello world and Because we've taken because I've taken computing theory, right? So you know about turning completeness More or less. Okay, so if you haven't this means that anything you can do in one program language that's Trying to remember the words that is Turing complete you can you can write that program in another language That is also Turing complete. So you BF is Turing complete you could write Microsoft Windows in BF. You could write Firefox or Chrome It would be crazy. I would not you know suggest you do that But you can and so if you want to go there'll be a link here where you can actually run this online with a JavaScript BF interpreter and Kind of what this whole class is about is the mystery behind like how does it go from those? Symbols to actual computation. Yeah, there's a question in the back Okay, forgot it. Okay. What's this nothing? It's my name part of it. It's my name ASU is my name. No The class name is actually a program Yeah, so There's actually a programming language that somebody developed that is Turing complete and this side changed all the spaces to underscores the tabs to slash T and the new lines to slash N and Using these three characters. They created an entire programming language called white space and this program outputs Hello world of spaces That's it. So the other really cool thing is it ignores everything. That's not white space So you can actually embed a white space program inside of another programming language Or like inside of an image. So yeah, you can do like double computation. It's kind of cool And yeah, here's a link you can go to check out all The white space interpreter written in a bunch of different languages What about this this language? Python Python 2 right. It's gonna be doesn't have the parentheses. Yeah, so python right So python takes in some input like this prints out. Hello world. What about this? Haskell yeah, good somebody got it Yeah, so this is Haskell code This is a crazy programming language that I really like that We're gonna actually talk about some of its features in the context of this class and What about this? Oh shoot This is the problem. This is x86 assembly specific for a specific assembler and that outputs. Hello world And so the point of all this is to show you that what like In some ways what you think of as a programming language is kind of arbitrary, right? I mean, it's You could code anything in any language. So Yeah, I guess so are all of these programming languages Yeah, would you actually want to code in all of them? No are none of them programming languages. Maybe I just made one of those up Some people have heard of them. So I need to make up my own specific language and then do that Some of them. Maybe some you'd use they have different purposes But the the point of this class and the whole point is what we're gonna study is how does a Program either a compiler or an interpreter or something. How does it take in? Essentially bytes on one side right raw bytes and perform some output or do some kind of computation In a way that's useful so I like to think of this as kind of a pipeline and so We have source code coming on one Right and that's just made up of bytes and then we have some lexer that's going to interpret those bytes and Generate something useful or something that our computer can understand because we really don't want to be worried about individual bytes, right the whole time So then those tokens are going to get passed to a parser and that job is to create a parse tree So it's going to understand what the program looks like and then we're going to actually analyze this tree to say does it make sense, right? Have you ever compiled the program that? Compiled and then you ran it and it crashed. I Think everybody should be nodding their head if you haven't done that I don't know you'd like the perfect programmer and you should have no problems with this class Right and why is that well because maybe the program wasn't valid or maybe you did something wrong a lot of these errors We can check for it early so we can say it does the type do the types in this system match Does it make sense to add to multiply a I'm trying to find the example. It doesn't work in a like Does it make sense to multiply like a string by a fraction or something like I Think that doesn't work in Python. Python messes up that example, but a String multiplied by a decimal number, right doesn't really mean anything So we should reject that program and then hopefully that outputs some valid parse tree where then some other component can say Okay, now let's compile that let's or let's interpret that or output something else Okay, so we touched on this a little bit So these are kind of gonna kind of be two of the three main things. We're gonna talk about so syntax So what is syntax? So I'm gonna raise their hand. There's too many of you to talk at once. I should get like Yeah, so a strut syntax is how you write the program Rules for yeah, yeah, yeah, so I think of it like what does it mean to look like like what is a valid program look like? Right, so we just don't want any arbitrary like pounding on the keyboard We want to have some well-defined way of what it looks like and who's that for us? Yeah, exactly So us as programmers, so we know how to write a program that at least looks like a valid program What about semantics? Raise this yeah What is what is it actually what was that right? So what does the program actually do? Yeah, so this is I kind of think what does it mean for a program to be valid? So one is talking about what does a valid program look like? Right, and the other one is what does it mean for a program to be valid? So this is where things like type system or defining a variable before you use it and see right those are all under semantics and Before anybody asks the question these kind of do bleed together because you can enforce some semantic things in the syntax But we don't have to get into that too much Especially at this stage of the game What about correctness does not make a program valid does it I don't know I Mean so I think of it is the program the correct one for the job is this program Right for the task and that's kind of a high-level thing I Like to think of it from a security perspective So I always think like does this program have any security vulnerabilities, right? Because that a program with security vulnerabilities is obviously not correct so What I try and like to do is can we write a Static analysis or some kind of tool that analyzes the program and can try to analyze this aspect of correctness, but Doing complete correctness your code is 100% correct It's very very difficult Questions Yeah Yeah, so the question is does it depend on the job in essence? Yeah, and so it depends I mean correctness is very vague because you as the programmer You may get a beautifully detailed Amazing spec that tells you exactly what you should do you go do that you write bug free code It's amazing and then three four months later You take it to the user and you're like look at this. I I implemented this program exactly to your spec It's amazing and they go ah, you know what that was like three months ago I like I don't really need that one feature anymore Can you like change that and make that font bigger and like put that box over here? And so you have like shifting requirements of what what even is correct? So yeah, it's very very nebulous topic and I always get to the point where it's like, okay If you have a spec that's good enough that you can mathematically verify that the code matches the spec Well, then you're just going to verify if your code has any of the bugs in that spec So I have to write things exactly right twice You have to have a spec that doesn't have any bugs and an implementation that doesn't have any bugs And I guess a checker that doesn't have any bugs Unless you use it you use it to check itself and then you get into whole your head explodes and Any other questions? Well, oh, you know, I guess it is the first day. All right, I guess we'll stop here and We'll see each other on Wednesday