Is it possible to write hello world using Datalog language? How can I write it? - datalog

My teacher task me to create hello world using datalog programming language
idont know where to start

Related

Creating calculator in abap

I've build a basic calculator in abap which is pretty simple and knows how to get 2 inputs and calculate them by pressing a push button of the operator( + - / *).
Now I want to make a calculator which gets one input like : "12+5*3-9"
But I really don't know how to start it.
Can anyone help me a little bit please?
Thank you.
You question is related with an algorithm for parsing mathematical strings rather than ABAP. One of them is Shunting-yard.
If you need to short way, you can add your expression into java script function and run it in CL_JAVA_SCRIPT class in ABAP.
Check example ABAP program DEMO_JAVA_SCRIPT_MINI_EDITOR.

Using Datalog by itself, is it possible?

I am currently studying Datalog for my report in class, I only need to discuss basic syntax and a basic example.
I know Datalog is usually used as a query language and is usually only implemented to other languages such as Java, Lua, C, etc. but is it possible to teach Datalog only by itself, or am I required to use another language implementing it to show a simple working program?
There are a few online demos you can use:
http://iris-reasoner.org/demo
http://ysangkok.github.io/mitre-datalog.js/wrapper.html
https://repl.logicblox.com/ (docs here:
https://developer.logicblox.com/content/docs4/tutorial/repl/section/split.html )
I haven't tried it myself yet, but http://abcdatalog.seas.harvard.edu also looks nice and easy to run.
A complete overview is on Wikipedia: https://en.wikipedia.org/wiki/Datalog

prolog program logic wrong

I am new to the Prolog programming language. When I give input as fly(x,y), I want a value to be displayed. I was just trying to execute the following code:-
fly(x,y):-
t is 1.5,
write(t).
Can I know what's wrong with this code?

Chatbot in Prolog

I've been trying to create a chatbot (as an assignment) in prolog, so far I have made a database in a .pl file and I have listed a lot of possible conversations.
I know that prolog works like this for example if we have
Chatbot(good)
and we type
?-Chatbot(good).
it will respond
yes or ture.
Now I don't know how to use my database so that the program can work exactly as a chatbot for example without the need to write in appropriate syntax:
Hello (typed by the user)
Hi there, (typed by the program automatically)
My database is like this:
answer( question, [
[Yes, I am here]]).
question ([are you there?])
The prototype chatbot I'm aware of is ELIZA by Weizenbaum 1966.
Implementing it in Prolog is rather easy, as shown in The Art of Prolog by Sterling & Shapiro.
Googling for 'ELIZA Prolog', the first link gives you a fairly complex implementation, and you could adapt/reuse the engine with your database. But this way you will lose all the fun. I suggest you read the book and take the time to implement your own.
edit
Just in case you haven't still seen it, SWISH offers a clean, barebone ELIZA implementation among its examples.

Examples to show how to use Racket lexer generator?

I am playing with the Racket recently, currently implementing a lexer for a subset of scripting language...and wondering whether there are more examples to show how to use the lexer generator in Racket?
I understand the calculator example in the doc, but it is too simple to show the full features...
I am especially curious how to reference position of each character....
The libraries at PLaneT are a great resource for more elaborate examples.
Try for example the Infix Parser .

Resources