dino-lang / dino

The programming language DINO
GNU General Public License v2.0
71 stars 5 forks source link

option -t do not generate code for "reduces" #11

Open akakima opened 7 years ago

akakima commented 7 years ago

When we use the option -t to trace parser at runtime, there is no code generated for "reduces". Is it by design ?

vnmakarov commented 7 years ago

Sorry, I did not understand your question. There are a few parsers in this code base.

If it is a question about MSTA. I should check it. -t should only add debugging print. If some code is not generated. It is probably a bug.

For Dino -t prints call stack at the exit. This stack might be not accurate because of call-tail optimization.

There is a test in dino.tst.in implementing tiny language called GRIP. The GRIP interpreter has also option -t. But I did not write this code (somebody else wrote it). So I can not answer the question if it is about GRIP.

akakima commented 7 years ago

Hi

Sorry for the ambiguous question... It's a question about -t of MSTA.

Using option -t with MSTA should generate debugging print. And there is no print generated for "reduces". But there are for shifts, token reading, ...

On 2016-11-26 13:06, vnmakarov wrote:

Sorry, I did not understand your question. There are a few parsers in this code base.

If it is a question about MSTA. I should check it. -t should only add debugging print. If some code is not generated. It is probably a bug.

For Dino -t prints call stack at the exit. This stack might be not accurate because of call-tail optimization.

There is a test in dino.tst.in implementing tiny language called GRIP. The GRIP interpreter has also option -t. But I did not write this code (somebody else wrote it). So I can not answer the question if it is about GRIP.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dino-lang/dino/issues/11#issuecomment-263077362, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzAy4RTllKJZTW-ZOTUzVGgiht5--5qks5rCHUwgaJpZM4K8jVS.

vnmakarov commented 7 years ago

I see. I think it is possible to add printing about some reduces. But it will be not full information. MSTA makes a lot of optimizations. For example, if there is not action, the corresponding reduce might be part of another reduce (chain reduces). Even if there is an action, several reduces can be combined as their actions.

Also MSTA for regular language can actually generate DFA where there are no reduces at all. So I can add debugging prints about reduces which have actions. But probably it is not what people would expect.

akakima commented 7 years ago

I see. I think it is possible to add printing about some reduces. But it will be not full information. MSTA makes a lot of optimizations. For example, if there is not action, the corresponding reduce might be part of another reduce (chain reduces). Even if there is an action, several reduces can be combined as their actions.

Also MSTA for regular language can actually generate DFA where there are no reduces at all. So I can add debugging prints about reduces which have actions. But probably it is not what people would expect.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dino-lang/dino/issues/11#issuecomment-263743658, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzAy0POOSaKIlft5Mi8641xKYLgmeQSks5rDME1gaJpZM4K8jVS.

Ah ! I see.

Is there an option or a combination of options that will disable optimisations, so the debuging prints will work Ok and make senses (corresponding to what people expects) ?

Whatever your response, you can close the ticket.

Thank you to have taken the time to respond.