Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where may I find a BNF grammar for prolog syntax?

481 views
Skip to first unread message

Peter Percival

unread,
Apr 12, 2017, 8:33:46 AM4/12/17
to
Where may I find a BNF grammar for prolog syntax?
--
Do, as a concession to my poor wits, Lord Darlington, just explain
to me what you really mean.
I think I had better not, Duchess. Nowadays to be intelligible is
to be found out. -- Oscar Wilde, Lady Windermere's Fan

Peter Percival

unread,
Apr 12, 2017, 8:49:06 AM4/12/17
to
Peter Percival wrote:
> Where may I find a BNF grammar for prolog syntax?

... or just of compound terms ("structures" in Clocksin & Mellish)?

burs...@gmail.com

unread,
Apr 12, 2017, 10:55:29 AM4/12/17
to
Browse comp.lang.prolog, there were similar questions.

BTW: The DEC-10 manual has a superbe compact grammar for Prolog.
See the section I.7. Full Prolog Syntax here:

Department of Artificial Intelligence
University of Edinburgh
DECsystem-10 PROLOG USER'S MANUAL
10 November 1982

http://www.cs.cmu.edu/Groups/AI/util/lang/prolog/doc/intro/prolog.doc

And then there is a verbose grammar in the ISO core standard.
And Ulrich Neumerkle has some test cases.

kint...@gmail.com

unread,
Apr 12, 2017, 10:59:02 AM4/12/17
to
prolog is famous for it's (old and wrongly pointing sure , but still great!) "dcg" capabilty which is perfect for parsing .

therefor there is no need for the partikular syntax of BNF via a via reference to the specification of the base syntaktik struktur recognizable by prolog -

in fact since most (all?) prolog implemntations are (duh! of course ...) writeen in prolog ,
and necessarily perform the task of parsing ,
you can find within them fairly simple BNF-like spoeciufications of the kore language strukture in simple to undefrstand dcg form -

if you are looking instead for a specification of syntax ,
which may appropriately used as the basis for ,
for example developing and example dcg parser for prolog and then instrukting them through the simple steps of causing such representation to transform via their instructions into the struktur of an ast , in advanced classes to becum perhaps an ast that is transformed as a subsequent consideration into a disparate AST struktur now organized to be executable by a meta-interpreter -
well prolog has been around for 50 years so the wise programmers of the past did what they could with prolog and then went on the better platforms like dart for example ,
which by the way as an aside is a great invention , dart , i'm glad google (after they stole the word "chrome" from firefox) decided to make the worlkd a better place by abandoning the syntax of hjavascript and giving to us instead the manifestation of the application of their perfect vision and effort in the form of yet-another-programming-language this time the one that's gonna save us from having to contend directly with the childlike styupidity that albeiot childlike did abolsih the need for the semicolon in the minds of programmer - well most programmer sure ! but not google programmers they are too busty inventing "go" another manifestation of a better worlkd , this time aweinsipring because so insightful as to have provided the ability to have 2 reurrn cvalues ! instead of 1 ! that's right we'
ll just use the comma for whatever the fuk we want ...
those dolts coulda just used a vectro to return however many fukin return arguments they want , buut no they're twqo busy working on "the semantics of the go language" they are gfonna give us the new innards we need they gave syntaz the only attention it deserved which was after-thought attention indeed they do contrend with the semi-colon ionbe wonders why though groovy and javascript did eliminate the need for semi-colon in the hearts and mionds of participants the go engineers with their glorius ability to create for us the new semantic workings of a mchine language that will make a better world ... with such an ability why indeed do they need to "insert a semi-colon" , as if their semantic struktur has now been shown to be dependent essentially on bizarro rekonstruktions of syntaktik input ?

Aeriously , tryu a google search for "go semantic semiotic sem-colon semicolon" or some-such and so whut those dorks have to say about the sem-kolon should be called the "nop" cf bash ...

btw , wtf does happebn when you do this in bash ?

$ : echo : ;

~~ kintalken ~~

kint...@gmail.com

unread,
Apr 12, 2017, 11:02:50 AM4/12/17
to
the iso-spec has a very very fantastik of an exact description of the expectations of standard prolog vis-a-via format of textual input .

you can get that spec , which I highly suggest ,
or you can simply look at the reference im[plementation which was designed to operate most easily in the logtalk environment ,
becuase taking advantage of the excellent testing dframework thus made available ,
a good plan (if you are targeting students) is to give to them those tests as requirements ,
and challenge them to then devlop parsers able to (incrementally) succeed at passing those tests ...

~~ kintalken ~~

kint...@gmail.com

unread,
Apr 12, 2017, 11:07:08 AM4/12/17
to
or you can do it the opposite way ,
give the students the text of the DEC-10 specification ,
and then challenge them to devlop tests in the logtalk environment ,
with such tests in all cases demonstrating ,

that every funktor is :

- able to be true for queries against valid concrete-nonnonground stat3e
- able to be true for all permutations of its arguments as variable ,
- able to be steadfast for all such invocations ,
- note that steadfastness best pursued as a susbsequent pursuit with its own permutation of argumentv testing because difficult to achieve ,
- able to be bi-directional

~~ kintalken ~~

kint...@gmail.com

unread,
Apr 12, 2017, 11:10:56 AM4/12/17
to
> Nowadays to be intelligible is
> to be found out. -- Oscar Wilde, Lady Windermere's Fan

/*
Variables for procedures are always passed by-reference . This is like the C++ example ```void whatever(int &foo) { foo = 2 ; }``` . As in C++ , a change to a variables value from within the procudure is propogated out to the caller . There is a further restriction compared to C++ . You are only allowed to set the value of a variable once . If you try to set a variable that has already been set , next your procedure abandons the current answer and returns (implicit) `false` . To set a variable to multiple values , you must generate multiple answers .
*/

/*
<?astimony:
Hey I looked back in the history of posts and it seems like you were using my account .
:astimony?>

<?kintalken:
Yeah , I did that because we are actually the same person .
:kintalken?>

<?astimony:
If we are the same person , then why are we pretending that we are 2 different people having a conversation ?
:astimony?>

<?kintalken:
Because sometimes the weasals attack toad hall .
Y!OU MIGHT BE ASSAULKTED BY A WHOLE GOOGLE OF TH#M >
:kintalken?>
*/


0 new messages