frontin.maringa.br
I think the most tiny compiler is this one github.com/jamiebuilds/th… by jamiebuilds.
* Parsing
* Transformation (codemod, @babeljs plugins, optimizations)
* Code Generation
And then you do Syntactic Analysis that will transform these tokens in AST
After you got your AST you can do some transformations on them much like a @babeljs plugin or you can do code generation.
You can use astexplorer.net where you can paste your code, learn about the AST of it, and play with some transformations
* AST as used on IDE to handle refactors
* AST is used by @geteslint to check rules
* @PrettierCode uses AST to pretty print your code
* @typescript and @flowtype uses to provide info for type checking
* @babeljs uses to transform new javascript code into old one
* @GraphQL uses to handle SDL and processing GraphQL query language
* @RelayModern uses AST to optimise all GraphQL queries
example:
CallExpression[callee.name='setTimeout'][arguments.length!=2]
For this you can use jscodeshift (github.com/facebook/jscod…) that uses recast under the hood (github.com/benjamn/recast).
* github.com/sibelius/ast-i… (transform your raw strings to i18n keys and extract all of them to a locale file)
* github.com/sibelius/codem… (transform imports from @reactnative v24 style to @reactnative v25 style)
* github.com/lucasbento/rn-… by @lbentosilva (transform from react-native import to new @ReactNativeComm packages)
* github.com/jongold/import… by @jongold (generic codemod to transform imports)
* github.com/reactjs/react-… by @reactjs