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

Soufflé: Declarative API #12

Closed
byakuren-hijiri opened this issue May 11, 2024 · 1 comment
Closed

Soufflé: Declarative API #12

byakuren-hijiri opened this issue May 11, 2024 · 1 comment
Labels
area:souffle Soufflé module enhancement New feature or request

Comments

@byakuren-hijiri
Copy link
Contributor

byakuren-hijiri commented May 11, 2024

It is possible to implement a declarative API that operates of the created Soufflé entities in lambda functions like:

const souffle = souffle(projectName, (s) => {
  const varUse = g.relation('varUse', ['var', 'func']);
  const varDecl = g.relation('varDecl', ['var', 'func']);
  const readOnly = g.relation('readOnly', ['var', 'func'], { io: "output" });
  const readOnlyRule1 = g.rule(
    readOnly,
    { relation: varDecl },
    { relation: varUse, negated: true }
  );
});

Which effectively describes the following Datalog rule and the relations in use:

readOnly(var, func) :-
    varDecl(var, func),
    !varUse(var, func),
@jubnzv
Copy link
Member

jubnzv commented Sep 1, 2024

It would be quite inconvenient to use, because facts and relations are connected to each other. It is much easier to write functions that construct AST within the given context as it implemented here: #120

@jubnzv jubnzv closed this as completed Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:souffle Soufflé module enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants