Compilers

Provided by:
8/10 stars
based on  15 reviews
Provided by:
Cost FREE
Start Date TBA

Course Details

Cost

FREE

Upcoming Schedule

  • TBA

Course Provider

Stanford Online online courses
Stanford Lagunita offers a variety of professional education opportunities in conjunction with many of the University’s schools and departments. We also offer an array of free online courses taught by Stanford faculty to lifelong learners worldwide. We foster collaboration with other education organizations by sharing course material, data-driven research, and source code for enhancements to our open-source platform Stanford Lagunita. We continually experiment to improve what we do throu...
Stanford Lagunita offers a variety of professional education opportunities in conjunction with many of the University’s schools and departments. We also offer an array of free online courses taught by Stanford faculty to lifelong learners worldwide. We foster collaboration with other education organizations by sharing course material, data-driven research, and source code for enhancements to our open-source platform Stanford Lagunita. We continually experiment to improve what we do through creative use of technology, and we share what we learn with the rest of the world.

Provider Subject Specialization
Sciences & Technology
393 reviews

Course Description

This self-paced course will discuss the major ideas used today in the implementation of programming language compilers, including lexical analysis, parsing, syntax-directed translation, abstract syntax trees, types and type checking, intermediate languages, dataflow analysis, program optimization, code generation, and runtime systems. As a result, you will learn how a program written in a high-level language designed for humans is systematically translated into a program written in low-level assembly more suited to machines. Along the way we will also touch on how programming languages are designed, programming language semantics, and why there are so many different kinds of programming languages.

The course lectures will be presented in short videos. To help you master the material, there will be in-lecture questions to answer, quizzes, and two exams: a midterm and a final. There will also be homework in the form of exercises tha...

This self-paced course will discuss the major ideas used today in the implementation of programming language compilers, including lexical analysis, parsing, syntax-directed translation, abstract syntax trees, types and type checking, intermediate languages, dataflow analysis, program optimization, code generation, and runtime systems. As a result, you will learn how a program written in a high-level language designed for humans is systematically translated into a program written in low-level assembly more suited to machines. Along the way we will also touch on how programming languages are designed, programming language semantics, and why there are so many different kinds of programming languages.

The course lectures will be presented in short videos. To help you master the material, there will be in-lecture questions to answer, quizzes, and two exams: a midterm and a final. There will also be homework in the form of exercises that ask you to show a sequence of logical steps needed to derive a specific result, such as the sequence of steps a type checker would perform to type check a piece of code, or the sequence of steps a parser would perform to parse an input string. This checking technology is the result of ongoing research at Stanford into developing innovative tools for education, and we're excited to be the first course ever to make it available to students.

An optional course project is to write a complete compiler for COOL, the Classroom Object Oriented Language. COOL has the essential features of a realistic programming language, but is small and simple enough that it can be implemented in a few thousand lines of code. Students who choose to do the project can implement it in either C++ or Java.

I hope you enjoy the course!

Why Study Compilers?

Everything that computers do is the result of some program, and all of the millions of programs in the world are written in one of the many thousands of programming languages that have been developed over the last 60 years. Designing and implementing a programming language turns out to be difficult; some of the best minds in computer science have thought about the problems involved and contributed beautiful and deep results. Learning something about compilers will show you the interplay of theory and practice in computer science, especially how powerful general ideas combined with engineering insight can lead to practical solutions to very hard problems. Knowing how a compiler works will also make you a better programmer and increase your ability to learn new programming languages quickly.

Compilers course image
Reviews 8/10 stars
15 Reviews for Compilers

Ratings details

  • 5 stars
  • 4 stars
  • 3 stars
  • 2 stars
  • 1 stars
  • 5 stars
  • 4 stars
  • 3 stars
  • 2 stars
  • 1 stars
  • 5 stars
  • 4 stars
  • 3 stars
  • 2 stars
  • 1 stars

Rankings are based on a provider's overall CourseTalk score, which takes into account both average rating and number of ratings. Stars round to the nearest half.

Sort By
Student profile image
Student profile image

Student

6/10 starsTaking Now
4 years ago
I like the overall course content but I think the step is too high from the first part of the course (lexical analysis, parsing) to the second part (writing assembly code from parse tree). You need a background in machine code and computer architecture. So, I think other courses (HW/SW interface, automata) are kind of a prerequisite to compiler. Apart from this, the course content is great!
Was this review helpful? Yes2
 Flag
Steven Frank profile image
Steven Frank profile image
10/10 starsTaking Now
  • 59 reviews
  • 57 completed
10 months, 3 weeks ago
Stanford's "CS1 Compilers" is less a course than a way of life -- thank goodness it's self-paced! The experience is like being asked to translate a novel into a sequence of foreign languages you're learning for the first time. The amount of work is prodigious, and I haven't even started the programming assignments yet. But this course deserves its reputation as the best there is on the subject. The instructor, Alex Aiken, is fantastic. His articulate, conversational style is easy to follow and he assumes a minimal CS background, just C and exposure to assembly language. The course material is broadly organized around four key components of compiler design: syntax, parsing, semantics and type checking, and code generation. So let's talk about the languages you'll learn. The language for which you'll be writing a compiler is COOL, the Classroom Object-Oriented Language written by Prof. Aiken. There's a tutorial, a referen... Stanford's "CS1 Compilers" is less a course than a way of life -- thank goodness it's self-paced! The experience is like being asked to translate a novel into a sequence of foreign languages you're learning for the first time. The amount of work is prodigious, and I haven't even started the programming assignments yet. But this course deserves its reputation as the best there is on the subject. The instructor, Alex Aiken, is fantastic. His articulate, conversational style is easy to follow and he assumes a minimal CS background, just C and exposure to assembly language. The course material is broadly organized around four key components of compiler design: syntax, parsing, semantics and type checking, and code generation. So let's talk about the languages you'll learn. The language for which you'll be writing a compiler is COOL, the Classroom Object-Oriented Language written by Prof. Aiken. There's a tutorial, a reference manual, and some example programs, but ultimately this is a new C++/Java-like object-oriented programming language you'll have to learn. Then we're on to the computer science. Lexical analysis partitions a high-level program into its basic lexical components (keywords, numbers, etc.) using the languages of regular expressions and formal grammars. Regular expressions, in turn, are implemented computationally by finite automata, which have their own peculiar language. The first programming assignment, which has you writing a lexical analyzer, uses a framework called Flex or Jlex, depending on whether you're coding the assignments in C++ or Java (the only allowed choices) -- so that's another language. The next step, parsing, uses the language of context-free grammars, and here's where things get pretty theoretical -- think parse trees and Noam Chomsky. After you master the languages of top-down and bottom-up parsing, you can put them to work using a tool called bison (for C++) or CUP (for Java) -- so that's yet another language. Now we're into semantic analysis and type checking, which use the rigorous language of formal logic (think mathematical proofs) and abstract syntax trees. For the programming assignment, you'll write a semantic analyzer involving 1500-3000 lines of code. Code generation, the final stage of the compiler you'll write, requires a fairly deep dive into assembly language (the MIPS language, in particular), and the lectures lead you through the complexities of register and stack management. In the programming assignment, you write a code generator (another 1500-3000 lines of C++ or Java) that creates MIPS assembly code for the abstract syntax tree generated by your semantic analyzer. Now, all of these programming assignments are actually optional. The mandatory assignments are six quizzes, which are difficult but allow unlimited attempts, and a midterm and final, which are killers and allow only one attempt at each question with no partial credit. But you'd be crazy not to at least attempt the programming assignments if you want to learn about compilers. This course is supremely well-taught and well-organized, and -- again -- mercifully self-paced. Just know what you're getting into and buckle up.
Was this review helpful? Yes1
 Flag
Won Jo profile image
Won Jo profile image

Won Jo

10/10 starsTaking Now
1 year, 1 month ago
This course help me a lot to understand about compilers. Contents are great and explanation is perfect. Thank you a lot.
Was this review helpful? Yes0
 Flag
chen alkabets profile image
chen alkabets profile image

chen alkabets

8/10 starsTaking Now
1 year, 5 months ago
the course is very interesting, the instructor is amazing. I think the course is not easy and the examples are too abstract ... a more concrete examples would be helpful for the non mathematician guy. anyway i really appreciate this online service
Was this review helpful? Yes0
 Flag
 profile image
 profile image

10/10 starsDropped
  • 6 reviews
  • 3 completed
2 years, 9 months ago
The content of this course is very thorough, and the instructor is very good. Unfortunately, I did not have sufficient preparation before the course to finish all the exercises. This is definitely an advanced course for students with a lot of experience in computer science concepts.
Was this review helpful? Yes0
 Flag
Anand B profile image
Anand B profile image
8/10 starsCompleted
  • 1 review
  • 1 completed
3 years, 3 months ago
The course structure is so good. The assignments and exams are challenging and fun. I would really recomend my juniors to take this course. The best thing I love about this course is that this course is self-placed.
Was this review helpful? Yes0
 Flag
Student profile image
Student profile image

Student

8/10 starsTaking Now
4 years ago
As mentioned by others there were still a couple of bugs but overall the course is great and I've leaned a lot. Maybe I'm getting old and slow but it seems like the assignment/s (I'm still on the first one) require a large time investment, it would be great if you could give some rough guidelines on how many hours people have spent on average so that we can set our expectations accordingly. Thanks again for providing this course
Was this review helpful? Yes1
 Flag
Sanjay Giri profile image
Sanjay Giri profile image
10/10 starsTaking Now
  • 1 review
  • 0 completed
4 years ago
i am currently taking programming languages course from univ of Washington and in the forum the TAs have been talking about how great this course in compilers is. I attempted to take this course last year but i may not have been well prepared then but this time i am planning on completing this course and starting right after i finish my current course "programming languages". I consider this course a great privilege for millions of students wanting to learn about compilers. Thank you Stanford!
Was this review helpful? Yes1
 Flag
Student profile image
Student profile image

Student

9/10 starsTaking Now
4 years ago
Overall course content is pretty mature but still contains errata and there are definitely room to improvement. I suggest to add a straightforward way to submit errata / content suggestions rather then forum topics. Looking forward to completing the course. Recommended
Was this review helpful? Yes0
 Flag
Amos Zilberberg profile image
Amos Zilberberg profile image
8/10 starsTaking Now
  • 1 review
  • 0 completed
4 years ago
Great course, very interesting. I tried to read the Dragon book on my own but its too concentrated and too academic. I'm more interested by the practical aspect. I wish there were more exercises to drill in the information
Was this review helpful? Yes0
 Flag
Lauri Rutanen profile image
Lauri Rutanen profile image
8/10 starsTaking Now
  • 1 review
  • 0 completed
4 years ago
Two first weeks of the course have been very interesting quest to theory of languages and I hope the rest of the course will be as interesting. I have made some sneak-peek into later weeks and so far it looks promising. In programming assignment 1, I found that the manual for jlex (a tool for this assignment's java version) was rather confusing. While this is in no way this course's fault, stressing that reading Lex manual first would be rather helpful for beginners and for those not well versed in gnu tools in general.
Was this review helpful? Yes0
 Flag
Student profile image
Student profile image

Student

10/10 starsTaking Now
4 years ago
I find there is a gap between the lectures and the difficulty level of the quizzes. It would be useful to have practice exercises to bridge the gap.
Was this review helpful? Yes0
 Flag
Леонид Чайка profile image
Леонид Чайка profile image
2/10 starsCompleted
  • 1 review
  • 1 completed
4 years ago
assignments should be 40 minutes long max! so you need divide each assignment into several
Was this review helpful? Yes0
 Flag
Student profile image
Student profile image

Student

8/10 starsTaking Now
4 years ago
I am looking forward to learn it all. It is great content. I am at Week 2. Video quality could be improved.
Was this review helpful? Yes0
 Flag
Student profile image
Student profile image

Student

10/10 starsCompleted
4 years ago
Was this review helpful? Yes0
 Flag

Rating Details


  • 5 stars
  • 4 stars
  • 3 stars
  • 2 stars
  • 1 stars
  • 5 stars
  • 4 stars
  • 3 stars
  • 2 stars
  • 1 stars
  • 5 stars
  • 4 stars
  • 3 stars
  • 2 stars
  • 1 stars

Rankings are based on a provider's overall CourseTalk score, which takes into account both average rating and number of ratings. Stars round to the nearest half.