@anteriorai/srg-parser
v0.5.1
Published
Universal parser for SRG (Symbolic Reasoning Graph) language - works in browser and Node.js
Readme
@anteriorai/srg-parser
Parser for the SRG (Symbolic Reasoning Graph) language. Converts .srg source files to Abstract Syntax Trees (AST).
Public preview. This package is an early public release of Anterior's symbolic reasoning tooling. It is being published to support transparency, research discussion, and early experimentation while the broader open-source repository is prepared for release.
Future releases may be made available under updated licensing terms. Until then, use of this package is governed by the license included with this release.
This release should not be treated as a supported product, a stable API, or a complete reference implementation. It is provided "as is," without warranties of any kind. Users are responsible for evaluating correctness, security, compliance, and suitability for their own use case.
Installation
npm install @anteriorai/srg-parserUsage
import { parse } from '@anteriorai/srg-parser';
const source = `
predicate is_adult: "Is patient 18 or older?"
outcome approved: "Approved"
is_adult => approved
`;
const ast = await parse(source);Bundler Configuration (Vite)
This package uses WASM. If you are using Vite, you may need to exclude it from dependency optimization to ensure WASM assets are loaded correctly in development mode:
// vite.config.js
export default defineConfig({
optimizeDeps: {
exclude: ['@anteriorai/srg-parser']
}
});API
parse(source: string): Promise<SourceFile>
Parses SRG source code and returns a typed AST with location information.
Types
All AST types are exported for TypeScript usage:
import type {
Position,
Location,
SourceFile,
PredicateDefinition,
OutcomeDefinition,
AggregatorDefinition,
Path,
Expression
} from '@anteriorai/srg-parser';