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

Correctly parse multi-sentence Common Logic theories #2110

Open
tillmo opened this issue Sep 21, 2022 · 2 comments
Open

Correctly parse multi-sentence Common Logic theories #2110

tillmo opened this issue Sep 21, 2022 · 2 comments

Comments

@tillmo
Copy link
Contributor

tillmo commented Sep 21, 2022

The following .clif file

(cl-comment "name-a" (P a))
(cl-comment "name-b" (P b))
(P c)

leads to a theory with one sentence:

. (cl-comment "name-a" (P a)) (cl-comment "name-b" (P b)) (P c)
                                                        %(name-a)%
@tillmo
Copy link
Contributor Author

tillmo commented Nov 17, 2022

The static analysis should return three sentences, not one, as currently done. The printer should print three sentences without . and without %(name-a)%, because this would be CASL syntax, not CLIF. As a result, the printed sentences should look the same as the input.

@daniilsvc
Copy link
Collaborator

Parser output

th2 = [Common.AS_Annotation.SenAttr
         _ Nothing True False False Nothing Nothing [] Nothing
         (CommonLogic.AS_CommonLogic.Text_meta
            (CommonLogic.AS_CommonLogic.Text
               [CommonLogic.AS_CommonLogic.Comment_text
                  (CommonLogic.AS_CommonLogic.Comment
                     ""name-a"" (Common.Id.Range []))
                  (CommonLogic.AS_CommonLogic.Text
                     [CommonLogic.AS_CommonLogic.Sentence
                        (CommonLogic.AS_CommonLogic.Atom_sent
                           (CommonLogic.AS_CommonLogic.Atom
                              (CommonLogic.AS_CommonLogic.Name_term
                                 (Common.Id.Token
                                    "P"
                                    (Common.Id.Range [Common.Id.SourcePos
                                                        ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test)
                                                        1 23])))
                              [CommonLogic.AS_CommonLogic.Term_seq
                                 (CommonLogic.AS_CommonLogic.Name_term
                                    (Common.Id.Token
                                       "a"
                                       (Common.Id.Range [Common.Id.SourcePos
                                                           ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test)
                                                           1 25])))])
                           (Common.Id.Range [Common.Id.SourcePos
                                               ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test) 1 23,
                                             Common.Id.SourcePos
                                               ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test) 1
                                               25]))]
                     (Common.Id.Range []))
                  (Common.Id.Range []),
                CommonLogic.AS_CommonLogic.Comment_text
                  (CommonLogic.AS_CommonLogic.Comment
                     ""name-b"" (Common.Id.Range []))
                  (CommonLogic.AS_CommonLogic.Text
                     [CommonLogic.AS_CommonLogic.Sentence
                        (CommonLogic.AS_CommonLogic.Atom_sent
                           (CommonLogic.AS_CommonLogic.Atom
                              (CommonLogic.AS_CommonLogic.Name_term
                                 (Common.Id.Token
                                    "P"
                                    (Common.Id.Range [Common.Id.SourcePos
                                                        ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test)
                                                        2 23])))
                              [CommonLogic.AS_CommonLogic.Term_seq
                                 (CommonLogic.AS_CommonLogic.Name_term
                                    (Common.Id.Token
                                       "b"
                                       (Common.Id.Range [Common.Id.SourcePos
                                                           ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test)
                                                           2 25])))])
                           (Common.Id.Range [Common.Id.SourcePos
                                               ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test) 2 23,
                                             Common.Id.SourcePos
                                               ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test) 2
                                               25]))]
                     (Common.Id.Range []))
                  (Common.Id.Range []),
                CommonLogic.AS_CommonLogic.Sentence
                  (CommonLogic.AS_CommonLogic.Atom_sent
                     (CommonLogic.AS_CommonLogic.Atom
                        (CommonLogic.AS_CommonLogic.Name_term
                           (Common.Id.Token
                              "P"
                              (Common.Id.Range [Common.Id.SourcePos
                                                  ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test) 3
                                                  2])))
                        [CommonLogic.AS_CommonLogic.Term_seq
                           (CommonLogic.AS_CommonLogic.Name_term
                              (Common.Id.Token
                                 "c"
                                 (Common.Id.Range [Common.Id.SourcePos
                                                     ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test)
                                                     3 4])))])
                     (Common.Id.Range [Common.Id.SourcePos
                                         ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test) 3 2,
                                       Common.Id.SourcePos
                                         ["file:///home/daniil/Documents/progs/Hets/test"](file:///home/daniil/Documents/progs/Hets/test) 3 4]))]
               (Common.Id.Range []))
            Nothing Nothing [])]

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

No branches or pull requests

2 participants