Sweet.js: Get Started
This course provides an introduction to Sweet.js, a macro engine on top of JavaScript which allows you to extend the language as you desire.
What you'll learn
Compile-to-JavaScript languages are popular, but sometimes these new languages are introducing features that you don't need, or don't address the problems which you want to solve. Sweet.js comes at it from another angle: rather than having a new language, it gives you the building blocks to make the extensions you need to solve your problems. Learn how to use macros to create specialized syntax and polyfill language-level features without an entirely new language.
Table of contents
- Macro Syntax 3m
- Demo: Writing a Simple Macro 3m
- Demo: Consuming a Macro 1m
- Demo: Understanding Macro Patterns 3m
- Demo: Values and Macro Patterns 1m
- Recapping Macro Workflows 3m
- Macros With Multiple Rules 2m
- Demo: Creating Macros With Multiple Rules 3m
- Recursive Macros 5m
- Avoiding Macro Recursion 5m
- Demo: Avoiding Macro Recursion 2m
- Case Macros 3m
- Demo: Simple Case Macro 2m
- Demo: Manipulating Syntax in Case Macros 7m
- Summary 3m
- Classifying Macro Tokens 2m
- Overview of Token Classes 2m
- Token Class Syntax 1m
- Custom Tokens Classes 1m
- Demo: Adding Tokens Restrictions 1m
- Demo: Different Templates With Macro Classes 1m
- Demo: Custom Token Classes 10m
- Demo: Custom Token Classes With Multiple Patterns 5m
- Demo: Runtime Type-Checking 4m
- Infix Macros 2m
- Demo: Adding Infix to an id Macro 1m
- Demo: Post-Expression Boolean Statements 2m
- Demo: Null-Guard via Infix 4m
- Conclusion 2m