ICodeSyntaxProvider
Interfaces · AiDotNet.ProgramSynthesis.Interfaces
Parses source code for the program synthesizer and the code-tokenization pipeline: syntax validation and abstract-syntax-tree extraction.
How It Works
For Beginners: a real parser lets AiDotNet check that generated code is valid and see its structure.
The TreeSitter implementation ships in the opt-in AiDotNet.CodeAnalysis.TreeSitter package, so its native
grammars stay out of the core package. Pass one through SyntaxProvider
(with AiModelBuilder.ConfigureProgramSynthesis) or the NeuralProgramSynthesizer constructor; without
one, validation falls back to generic structural checks and pipelines produce no AST.
Methods
| Method | Summary |
|---|---|
bool TryExtractAst(string code, ProgramLanguage language, CodeTokenizationPipelineOptions options, List<CodeAstNode> nodes, List<CodeAstEdge> edges) |
Extracts the abstract syntax tree of code. |
bool? TryValidate(ProgramLanguage language, string sourceCode) |
Validates sourceCode as language. |