Mentions légales du service

Skip to content

Enhance Readability and Syntax Compliance of Datalog Rules

GUILLAUME Maxime requested to merge fix/datalog-pprint into master

Description:

This MR addresses an issue where the idb command outputs a program that is not compatible with db_test. The modifications introduced in this MR are twofold:

  1. Syntax Correction: Ensures that all Datalog rules are properly terminated with a period (.).
  2. Readability Enhancement: Improves the spacing between predicates in the bodies of Datalog rules to enhance readability.

Changes Made:

Before this MR:

S_A(a,b,c,d) :- a(e,d),b(b,f),c(g,a),d(c,h) ,S_A(g,f,h,e)
  
S_A(a,b,a,b) . 
  
S(a,b) :- S_A(c,c,a,b)

After this MR:

S_A(a,b,c,d) :- a(e,d), b(b,f), c(g,a), d(c,h), S_A(g,f,h,e).
  
S_A(a,b,a,b).
  
S(a,b) :- S_A(c,c,a,b).

Additional Notes:

I'm not very familiar with advanced usages of Format.fprintf. There may be potential regressions in scenarios where rules are split across lines, I don't know which convention you're using.

Merge request reports