Java binding to the C runtime: parsing error (incomplete sentence)

29 views
Skip to first unread message

Gustavo Carvalho

unread,
Sep 25, 2020, 3:07:40 AM9/25/20
to gf-...@googlegroups.com
Dear All,

We have been trying to use the Java binding to the C runtime. Strangely enough, it works in one computer, but not in others. Somehow, it seems to be related to the usage of literals in the grammar. We cannot understand why. We would deeply appreciate it if you could help us.

1. The GF has been installed on all computers using the same .deb file (gf_3.10-2_amd64.deb). However, we are using different OSs (Ubuntu 16.04, Ubuntu 18.04, and Ubuntu 19.10).

2. We are using the same JDK on all computers.

3. You can download the Eclipse project from the following link. You may need to update the Java build path (in Eclipse), since it is considering an absolute path to the jpgf.jar file.


4. There is a computer (the one running Ubuntu 16.04) where this code works as expected. The output provided by the program is:

Starting GF (java)
Parsking: ok!
this wine is warm = foo


5. In the other two computers, when we run the same program, we get the following parsing error:

Starting GF (java)
org.grammaticalframework.pgf.ParseError: The sentence is incomplete

6. We are using a modified version of the Food grammar. We have only introduced a String literal as follows:

(abstract grammar)
Is : String -> Item -> Quality -> Phrase ;

(concrete grammar)
Is str item quality = {s = item.s ++ "is" ++ quality.s ++ " = " ++ str.s} ;

7. If we remove this String literal, the code works properly on all computers.

(abstract grammar)
Is : Item -> Quality -> Phrase ;

(concrete grammar)
Is item quality = {s = item.s ++ "is" ++ quality.s} ;

8. Finally, this problem only happens when parsing a string (i.e., it works when only calling the linearisation method).

Thank you in advance for your help.

Best regards,
Gustavo

Krasimir Angelov

unread,
Oct 2, 2020, 1:14:02 PM10/2/20
to Grammatical Framework
Hi Gustavo,

I tried your code but I can't reproduce it. Could it be that on one computer you have older version of the C runtime than on another? It is hard to help if I can't reproduce the problem.

If you have built the runtime from sources then try the following. The parser is in src/runtime/c/pgf/parser.c. In the beginning of the file you will see this:

//#define PGF_PARSER_DEBUG

Uncomment the line and recompile the runtime. Now everytime when you try to parse something the parser will print step by step, what it is doing. In this way we will at least have some more information about what is happening.

Best Regards,
Krasimir


--

---
You received this message because you are subscribed to the Google Groups "Grammatical Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gf-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gf-dev/CAL44rvatvBN1zta7tamVMcbRRAkrLOqW7qXsND9f9r1vAQtX7Q%40mail.gmail.com.

Gustavo Carvalho

unread,
Oct 8, 2020, 1:04:18 PM10/8/20
to gf-...@googlegroups.com
Hi Krasimir,

I am sorry for my late reply. We have done as you instructed (compiling/using the latest version of the C runtime), and it is now working! Thank you very much for your help. I am attaching to this message the output produced when we uncomment the define command. When we comment this command, we get the output shown below:

unnamed.png

Thank you once again.

Best regards,
Gustavo

output.txt
Reply all
Reply to author
Forward
0 new messages