Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to parse to fine-grained statements? #10

Open
Subway2023 opened this issue Dec 11, 2024 · 0 comments
Open

How to parse to fine-grained statements? #10

Subway2023 opened this issue Dec 11, 2024 · 0 comments

Comments

@Subway2023
Copy link

I used the method from CircomFilesVisitor for parsing. However, the parsing result is coarse-grained and does not parse each statement in the Circom program.

test.ts

import { getCircomParser, ParserError } from '@distributedlab/circom-parser';

import CircomFilesVisitor from './CircomFilesVisitor';

let source="/mnt/sdd1/sbw/circom/test_circomParser/historyBug/circom/208.circom"

const parser = getCircomParser(source);

const visitor = new CircomFilesVisitor(source);

visitor.visit(parser.circuit());

let temp=visitor.fileData;
let templates=temp.templates;
console.log("templates",templates)
templates {
  Example: {
    parameters: [],
    isCustom: false,
    parallel: false,
    context: TemplateDefinitionContext {
      parentCtx: [BlockDefinitonContext],
      invokingState: 176,
      children: [Array],
      start: [Pt],
      stop: [Pt],
      exception: null,
      _argNames: undefined,
      parser: [ExtendedCircomParser]
    }
  }
}
1733928298119

I want to obtain a fine-grained parse tree at the statement level, like the one on the far right in the image. What should I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant