Package Exports
- @je-es/ast-analyzer
- @je-es/ast-analyzer/dist/ast-analyzer.js
- @je-es/ast-analyzer/dist/ast-analyzer.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@je-es/ast-analyzer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
A static analysis tool that traverses the AST
to perform semantic checks, validation, scope resolution, and error detection.
Install
npm install @je-es/ast-analyzer
import { Analyzer } from "@je-es/ast-analyzer";
Usage
// suppose we want to analyze the represented AST for this statement: pub let mut x: i32 = 42// [1] Create syntax const syntax = Syntax.create({ // :: using @je-es/syntax(parser/lexer) name : 'Kemet', version : '0.0.1', lexer : lexerRules, parser : parserRules, settings : parserSettings } as syntax.SyntaxConfig ); // [2] Parsing the input const parser_result = syntax.parse('pub let mut x: i32 = 42'); // [3] Create module using the parser result const main_module = AST.Module.create( // :: using @je-es/ast // Name 'main', // Statements parser_result.ast.length > 0 // in my case, first item refers to an array of stmts. ? parser_result.ast[0].getCustomData()! as AST.StmtNode[] // otherwise, empty module. : [], // Metadata { path: './src/main.k' } ); // [4] Create program with the created module const program = AST.Program.create([main_module], { entryModule: 'main', path: './' }); // [5] Create analyzer for the created program const analyzer = Analyzer.create({ debug: 'off' }); const analyzer_result = analyzer.analyze(program);
Related
kemet-lang (MVP)
1. @je-es/lexer
2. @je-es/parser
3. @je-es/ast
4. @je-es/syntax
5.
@je-es/ast-analyzer6. @je-es/project
7. @je-es/lsp
8. @je-es/codegen
9. @je-es/compiler