parsing many files at once, and emitting separate modules
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Think about how to parse a whole directory of files at once.
One possibility is to create a root FilesNode that contains many FileNode nodes underneath it. Each FileNode can contain information about its location on disk, plus a complete AST. That way a single walk across the FilesNode AST can cover all files at once. The code generator can be modified to output different files instead of one giant block of code.
Each File can be treated like an AMD module. `Character.angl` exports a single value: the Character class / Angl object / TypeScript class. `audioControlPlaySong` exports a single function. Sprites can export the sprite's data structure. (Use an AMD loader plugin for sprites and other resources?)
Files will have to track their own module dependencies and generate code to require() those modules into local variables.
Care should be taken to detect any naming conflicts between modules and local variables; either rewrite the module name or rewrite the local variable name.
Relates to a more advanced concept of global identifiers: a global identifier can be linked to a module. For example, all of GML's math functions can be stored in a GmlMath module. Any time angl code uses any of those functions, the corresponding file must generate a `var GmlMath = require('gml-math');`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.