My first exam of the semester is in Programing Languages (CSE 262), which is a class on understanding programming languages in general as opposed to learning just one language in a class. The first exam is on three chapters and some additional material. The three chapters are Syntax, Lexical and Syntactic Analysis, and Names and Scopes. If you have any programming experience, you probably understand most of these topics at least for a particular languages. This classes discusses these topics in groups that apply to almost all computer languages.
In the syntax chapter we discussed different kinds of grammars which are the formal ways of specifying the syntax of the language. If some code does not match the syntax of a language it will lead to a compiler, or interpreter error. We learned how to prove if a line of code fit in the syntax of a language given its grammar.
In the next chapter we learned about the ways lexers and parsers work and even create ones of our own in Java. Lexers convert a sequence of chars into tokens which can be better understood by the parser. The parser checks if the ordering of the tokens is correct for the language.
In the chapter on names and scopes we learned about how different languages allow different kinds of names for variables, classes, methods, etc. The scope of a variable is the region of code where that variable can be accessed and the lifetime is the region that the variable’s value is stored in memory. There are two different kinds of scoping, static and dynamic, which decide what the variables value is if it is declared in multiple places.