Tags
Language
Tags
December 2024
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 1 2 3 4

Creating A C Compiler From Scratch - Module 1

Posted By: ELK1nG
Creating A C Compiler From Scratch - Module 1

Creating A C Compiler From Scratch - Module 1
Published 9/2022
MP4 | Video: h264, 1280x720 | Audio: AAC, 44.1 KHz
Language: English | Size: 9.61 GB | Duration: 14h 16m

Compiler Development, Lexical Analysis, Parsing, Code Generation, Abstract Syntax Trees

What you'll learn
How to build a C compiler from scratch
Full understanding of stackframes and how assembly language is generared for a C source file
Complete Understanding of lexical analysis and parsing
Stronger Assembly language skills will be gained
Requirements
You must have a basic experience of assembly language. In module 2 we will provide some lessons on assembly language however your recommended to come with some understanding.
Description
Learn to create your very own C compiler from scratch. In this course we develop a compiler that compiles a subset of the C Programming Language. By the time you finish all modules of this course you will be able to compile C programs that use pointers, structures, unions, arrays, functions, for loops, while loops. do while loops, if statements, switches and much more!Our compiler also has a preprocessor macro system allowing you to include header files and create definitions just like you would in any C file.Your compiler is advanced enough to use the GCC standard library so we are able to call C functions from our compiler. Your compiler will be able to compile the C programming language.This course does not rely on any frameworks we do everything from scratch to ensure the best possible learning experience for students Module 1In module 1 of this course we load our C source file that we wish to compile, into memory. We create a lexer to preform lexical analysis on the source input which will convert the source code into a bunch of tokens that our compiler can easily understand. We then pass the tokens through a parser to produce an abstract syntax tree. An AST describes the C program in a logical way that makes it easier for our compiler to understand. For example for the expression 50 + 20 you will end up with a root expression node that has a left operand that has a node of value 50 and a right operand that has a node of value 20. Breaking down problems in this way makes it much easier to create compilers.Module 2In module 2 of this course we create a code generator that produces 32 bit Intel assembly language that can then be passed through an assembler to produce a program binary that we can run. We also in this module create a resolver system which is responsible for taking a complicated expression such as "a->b.c.e[50] = 50" and breaking it down into simple steps and rules that our code generator can then easily follow. This abstraction is essential to ensure that the code generator does not become over complex. With the use of a resolver system we can ensure the code base remains clean.Module 3In module 3 of this course we create a preprocessor and macro system. This preprocessor system allows us to include header files in our C programs and also use a variety of macro keywords such as "#define" "#ifdef" , "sizeof" and many more. We also create a semantic validator that ensures that we have written valid C code. Examples of invalid C code would be setting variables that do not exist. Our validator will catch these errors and let the programmer know he needs to declare variable "a" before setting it. This is the only video course in the world that shows you how to create a C compiler, come and learn today!

Overview

Section 1: Course Overview

Lecture 1 Introduction

Lecture 2 Overview Of The Course

Section 2: Installation And Setup

Lecture 3 Installation And Setup

Lecture 4 Preparing our project

Section 3: Lexical Analysis

Lecture 5 What is Lexical Analysis

Lecture 6 Creating our token structures

Lecture 7 Preparing Our Lexer

Lecture 8 Creating a number token

Lecture 9 Creating a string token

Lecture 10 Creating a operator token

Lecture 11 Creating a symbol token

Lecture 12 Creating a identifier token

Lecture 13 Creating a keyword token

Lecture 14 Creating a new line token

Lecture 15 Creating a comment token

Lecture 16 Handling quotes in the Lexer

Lecture 17 Implementing Hexadecimal Numbers

Lecture 18 Implementing Binary Numbers

Lecture 19 Dealing with the parentheses buffer

Lecture 20 Creating tokens outside of the input file

Lecture 21 Creating number types

Lecture 22 Finalizing the lexer

Section 4: Parsing The C Programming Language

Lecture 23 What is parsing?

Lecture 24 Creating our parser structures

Lecture 25 Writing our parser template

Lecture 26 Creating our node file

Lecture 27 Creating Our First Node

Lecture 28 Creating an expression node

Lecture 29 Dealing with precedence in expressions - Part 1

Lecture 30 Dealing with precedence in expressions - Part 2

Lecture 31 Dealing with precedence in expressions - Part 3

Lecture 32 Creating an identifier node

Lecture 33 Implementing datatypes and keywords - Part 1

Lecture 34 Implementing datatypes and keywords - Part 2

Lecture 35 Implementing datatypes and keywords - Part 3

Lecture 36 Implementing datatypes and keywords - Part 4

Lecture 37 Understanding scopes

Lecture 38 Implementing the scopes

Lecture 39 Understanding Symbol Resolution

Lecture 40 Implementing The Symbol Resolver

Lecture 41 Implementing datatypes and keywords - Part 5

Lecture 42 Implementing Variables Part 1

Lecture 43 Implementing Variables Part 2

Lecture 44 Implementing Variables Part 3

Lecture 45 Understanding Array Declarations

Lecture 46 Implementing the calculation of array sizes

Lecture 47 Implementing Structures - Part 1

Lecture 48 Implementing Structures - Part 2

Lecture 49 Implementing Body's - Part 1

Lecture 50 What is padding and alignment

Lecture 51 Implementing datatype size functions

Lecture 52 Implementing variable size functions

Lecture 53 Implementing Alignment And Padding Functions

Lecture 54 Implementing Body's - Part 2

Lecture 55 Implementing Body's - Part 3

Lecture 56 Scope offsets explained

Lecture 57 Implementing parser scope entities and functionalities

Lecture 58 Implementing the variable node scope offsets - Part 1

Lecture 59 Implementing the variable node scope offsets - Part 2

Lecture 60 Implementing the variable node scope offsets - Part 3

Lecture 61 Pushing variables to the scope

Lecture 62 Implementing Body's - Part 4

Lecture 63 Implementing Body's - Part 5

Lecture 64 Implementing Structures - Part 3

Lecture 65 Implementing Structures - Part 4

Lecture 66 Initializing our symbol resolver

Lecture 67 Testing our structure functionality

Lecture 68 Error checking our structures

Lecture 69 Project Cleanup

Lecture 70 Understanding Functions

Lecture 71 Implementing the function structures

Lecture 72 Parsing Functions

Lecture 73 Parsing function arguments

Lecture 74 Dealing with upward stacks

Lecture 75 Changing the parsing of identifiers

Lecture 76 Res = 0 is missing

Lecture 77 Implementing expression parentheses

Lecture 78 Implementing IF statements

Lecture 79 Implementing Else And Else If

Lecture 80 Fixing some compiler warnings

Lecture 81 Implementing the return statement

Lecture 82 Implementing for loops

Lecture 83 Implementing while loops

Lecture 84 Implementing Do While Loops

Lecture 85 Implementing switch statements

Lecture 86 Implementing continue and break

Lecture 87 Implementing labels

Lecture 88 Implementing goto

Lecture 89 Implementing switch cases

Lecture 90 Implementing tenaries

Lecture 91 Implementing commas

Lecture 92 Implementing array brackets

Lecture 93 Implementing casts

Lecture 94 Case indexes or our register case function

Lecture 95 Understanding Fixups

Lecture 96 Creating our fixup core functionality

Lecture 97 Integrating our fixup functionality into the parser

Lecture 98 Parsing forward declarations

Lecture 99 Parsing unions

Lecture 100 Adjusting the function stack size

Lecture 101 Additional reordering of nodes

Lecture 102 Module 2

People with an interest in compiler design,People who are interested in assembly language,People who are interested in the C Programming language