# parser **Repository Path**: atlisp/parser ## Basic Information - **Project Name**: parser - **Description**: autolisp 语言解析器 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-02 - **Last Updated**: 2026-07-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # @atlisp/parser S-expression parser for AutoLISP — AST types, tree walker, visitor pattern. ## Install ```sh npm install @atlisp/parser ``` ## Usage ```ts import { parseAst, astWalk, astIsList, astIsSymbol, AstVisitor } from '@atlisp/parser' const ast = parseAst('(+ 1 2 (* 3 4))') // Walk all nodes for (const node of astWalk(ast)) { console.log(node.type, node.pos) } // Check node types if (astIsList(ast)) { /* ... */ } if (astIsSymbol(node, 'defun')) { /* ... */ } // Visitor pattern const visitor = new AstVisitor() visitor.on('defun', (node) => { console.log('Found defun:', node.children?.[1]?.name) }) visitor.run(ast) ``` ## API | Function | Description | |----------|-------------| | `parseAst(content)` | Parse entire input into an AST root node | | `parseContent(content)` | Parse input, return top-level forms as array | | `astChildren(node)` | Get children of a node | | `astIsSymbol(node, name?)` | Type guard for symbol nodes | | `astIsList(node, head?)` | Type guard for list nodes | | `astWalk(node)` | Generator yielding all descendants depth-first | | `astFindAll(node, predicate)` | Find all nodes matching a predicate | | `astFindListWithHead(node, headName)` | Find lists with a given head symbol | | `AstVisitor` | Class with `on(name, handler)` / `run(root)` | ## Build ```sh npm run build # tsc npm run typecheck # tsc --noEmit ```