
Code your own html language in C and apply these techniques to any language; Alexa transforms code to tokens, then the html parser interprets the language under a defined grammar.
Start a new project to create html and css, build a console-based gui for c apps, and implement an html lexer to parse tags into tokens.
Create a custom HTML language in C by defining token types (text, tag start, tag end, self closed), building constructors and show functions, and parsing token streams for a parser.
Define and implement a simple garbage collector in C by building a dynamic array, managing allocations with malloc and realloc, and freeing token contents.
Episode four outlines preparing the HTML lexer in C, showing token copying, a memory copy utility, and a token get function with garbage collection to enable lexical analysis.
Implement an html lexer in c for the Edgehtml project, building token types, a cons function, and a garbage-collected token list to parse html text and tags.
Prepare the HTML parser by designing a stack-based token workflow, using push and alternative pop to handle nested tags, and wire a parser module in C with parser.c and parser.h.
Continue building the html parser in c by implementing a pop on the stack of html tags. Update the stack length, return a matching token, and enable garbage collection.
Define the language grammar in bnf to specify production rules for a minimal html with document, head containing title, and body with tag and text tokens.
Develop a stack-based parsing function for a custom HTML language in C, using tokens, start tag detection, and a recursive parse loop to validate open tags.
Today we begin developing our own HTML language in C.
About the course
We will eventually use it to create console based graphical user interfaces for C applications and we'll also write our own CSS eventually. In the first episode we'll focus on getting everything prepared for the HTML parser and we're going to take influences from the functional style of writing code and also from our compiler episode.
The techniques taught in this course is not only useful for HTML. Everything is applicable no matter what kind of programming language you wish to create, or any existing language you want to parse. For instance, you can write your own C compiler or invent your own programming language. All you need is some basic C programming skills and the contents of this course.
You will learn how to code a lexer, which will turn the code into tokens, the smallest atomic part of any programming language. Then you will define the grammar according to the format taught in this course (bnf). The third step is to parse the tokens according to the language, by writing a recursive functional parser. And the final step is using your code, like rendering web pages (html), emitting assembly or machine code (c compiler) etc.
About the author
Dr. Jonas is an experienced instructor who's been coding C for 25 years and teaching it for 7 years. His popular Youtube channel has 35 000 subscribers and he's also running his own TV channel with programming content. He's an appreciated teacher with stunning reviews and several C programming courses of different kind.
Enroll Today! Or check out the free previews.