Page 1 of 1

How to implement syntactic analysis of Simple Precedence

Posted: Thu May 03, 2012 12:51 am
by halastoi
I have to do in lisp, algorithm of simple preceding.
Here I found some links with information about Simple Precedence Grammars, but I do not understand how to do this in CLISP.

Here's a link

Here's another link

May you have some ideas how to do this in CLISP, even in pseudocode.
Thanks in advance!

Re: How to implement syntactic analysis of Simple Precedence

Posted: Thu May 03, 2012 3:16 am
by wvxvw
What exactly are you trying to do? Are you trying to write a parser or a parser generator? Or do you need to assert whether the supplied input could be, in theory, be a product of a simple precedence formal grammar?

Re: How to implement syntactic analysis of Simple Precedence

Posted: Thu May 03, 2012 4:38 am
by wvxvw
It is probably best to have this conversation public, because if you solve the problem, then whoever reads this forum may benefit from that too - that's a purpose of the forum.

Besides, it would be much better if you could show what you already tried. Once you can show a practical problem, it's easier to tell you how to fix it. I still don't understand what exactly you are trying to do. Every non-trivial program reads input and writes output by some "rules", but this doesn't answer my question about what you want the program to do. The task implies you might have a grammar defined and you want to implement it in code, or, you may write a program, that given any grammar that fits the definition will generate the parser. Or you can process the product of the grammar, assuming it was written by some set of rules, which adhere to the definition of the grammar (this grammar is by definition reversible) and try to restore the set of rules used to generate the grammar. One more possibility is that you want to generate all grammar products for any given grammar if it is a simple precedence grammar (sounds a bit wasteful, but who knows...)