Learn Definite Clause Grammars (DCG) with Toki Pona
With the Definite Clause Grammars (DCG) is it possible to describe a language.
But this is not a simple thing because natural languages are not simple.
DCG programs represent mostly only parts of a human language.
My aim is to describe a complete language.
This language has to be very simple because I am not a genius.
For example Esperanto is not simple enough (for me ;-).
I hope Toki Pona is simple enough for my aim.
I write Prolog scripts to describe the grammar rules of every of Toki Pona lessons of my website.
DCG notation is syntactic sugar for normal definite clauses of Prolog.
Prolog is an old programming language for artificial intelligence.
Prolog is different to the most programming languages.
You don't have to program the solution for a problem.
You describe the situation and Prolog tries to find the solution.
For Prolog it's better if you have not experiences in other programming languages. ;-)
Not every implementation of Prolog support DCG.
I use the free SWI-Prolog.
You can test some of my scripts without installing SWI-Prolog.
Use Chromium browser and go to http://swish.swi-prolog.org.
Click in the left window on "Program" and copy the cource code in the left window.
In the bottom right you can type your query.
For example the query to list all possible sentences with this grammar:
The button "Next" show the next possibility.
This is the same as ";" in installed prolog.
The Prolog script of the first lesson in the browser.
To Learn Prolog
To Learn DCG