{"id":1004,"date":"2018-08-05T07:19:22","date_gmt":"2018-08-05T01:49:22","guid":{"rendered":"http:\/\/www.rangakrish.com\/?p=1004"},"modified":"2018-08-05T07:27:36","modified_gmt":"2018-08-05T01:57:36","slug":"sicstus-prolog-building-a-windows-dll","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2018\/08\/05\/sicstus-prolog-building-a-windows-dll\/","title":{"rendered":"Sicstus Prolog &#8211; Building a Windows DLL"},"content":{"rendered":"<p>Last week I upgraded to the latest version (4.4.1) of <a href=\"https:\/\/sicstus.sics.se\" target=\"_blank\" rel=\"noopener\"><strong>Sicstus Prolog<\/strong><\/a>\u00a0for Windows.\u00a0Since the Prolog engine can be embedded (royalty free) in other applications, it is useful to understand how to create a <em><strong>DLL<\/strong><\/em> (on Windows) for this purpose. In today&#8217;s article, I would like to outline this process in sufficient detail because I found the official documentation a little wanting in this area.<\/p>\n<p>One important point to remember: Unlike a program written in other languages such as <em><strong>Lisp, Go, C++<\/strong><\/em>, etc., we cannot <em><strong>directly<\/strong><\/em> convert a Sicstus Prolog program into a <em><strong>DLL<\/strong><\/em>. Instead, we have to write an intermediate layer (preferably in C\/C++) that loads a compiled Prolog program image into memory and invokes the desired predicates.<\/p>\n<p>The example I am going to use for this article is based on the <em><strong>Train.pl<\/strong><\/em> example discussed in the <em><strong>Sicstus.pdf<\/strong><\/em> file (page 328) available as part of the product distribution.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>Instead of distributing the Prolog source program, it is common practice to generate an image file (<em><strong>.sav<\/strong><\/em>) from the program and load that image at runtime. Creating the image file is straightforward.<\/p>\n<figure id=\"attachment_1005\" aria-describedby=\"caption-attachment-1005\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image.png\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"1005\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/08\/05\/sicstus-prolog-building-a-windows-dll\/saving-prolog-image\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image.png\" data-orig-size=\"824,156\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Creating Prolog Program Image\" data-image-description=\"&lt;p&gt;Creating Prolog Program Image&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Creating Prolog Program Image&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image-300x57.png\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image.png\" class=\"wp-image-1005\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image.png?resize=650%2C123\" alt=\"Creating Prolog Program Image\" width=\"650\" height=\"123\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image.png?w=824&amp;ssl=1 824w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image.png?resize=300%2C57&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Saving-Prolog-Image.png?resize=768%2C145&amp;ssl=1 768w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-1005\" class=\"wp-caption-text\"><strong>Creating Prolog Program Image<\/strong><\/figcaption><\/figure>\n<h3>Creating the DLL<\/h3>\n<p>We need a C\/C++ program for the <em><strong>DLL<\/strong><\/em>. I am going to use the file <em><strong>Train.c<\/strong><\/em>\u00a0explained in the example. However, the example shows the steps for building a standalone <em><strong>.exe<\/strong><\/em> file, so I will modify it slightly for building a <em><strong>DLL<\/strong><\/em>. The main change is to decorate the entry point with the <em><strong>__declspec(dllexport)<\/strong><\/em> declaration, so that it can be called from another library. This function sets up the Prolog engine, loads the saved program image and calls the prolog predicate <em><strong>connected<\/strong><\/em> to generate solutions.<\/p>\n<p>In order to build a <em><strong>DLL<\/strong><\/em> from this code, we need <em><strong>Visual Studio 2017 (64 bit)<\/strong><\/em> compiler. I have that installed already on my machine.<\/p>\n<p>Next, we need the <em><strong>Developer Command Prompt for VS2017<\/strong><\/em>. See <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/framework\/tools\/developer-command-prompt-for-vs\" target=\"_blank\" rel=\"noopener\"><strong>this<\/strong><\/a>\u00a0article to learn how to launch it.<\/p>\n<p>By default, this environment is configured for generating <em><strong>x86<\/strong><\/em> code. Since we need to build for 64 bit target, we have to run the <em><strong>vcvars64.bat<\/strong><\/em> file. On my machine, the file is located in <em><strong>G:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Auxiliary\\Build<\/strong><\/em>\u00a0directory. Once this batch file is run, the environment is correctly set up for 64 bit target. You can check this by running the <em><strong>CL<\/strong><\/em> command at the prompt. See image below.<\/p>\n<figure id=\"attachment_1006\" aria-describedby=\"caption-attachment-1006\" style=\"width: 651px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1006\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/08\/05\/sicstus-prolog-building-a-windows-dll\/developer-prompt-vs2017\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017.png\" data-orig-size=\"892,444\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Developer Prompt VS2017\" data-image-description=\"&lt;p&gt;Developer Prompt VS2017&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Developer Prompt VS2017&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017-300x149.png\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017.png\" class=\"wp-image-1006\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017.png?resize=651%2C324\" alt=\"Developer Prompt VS2017\" width=\"651\" height=\"324\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017.png?w=892&amp;ssl=1 892w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017.png?resize=300%2C149&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Developer-Prompt-VS2017.png?resize=768%2C382&amp;ssl=1 768w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/a><figcaption id=\"caption-attachment-1006\" class=\"wp-caption-text\"><strong>Developer Prompt VS2017<\/strong><\/figcaption><\/figure>\n<p>Lets us now <em><strong>CD<\/strong><\/em> to the directory where the sourse code is present. I have included Sicstus Prolog Bin directory in my System <em><strong>PATH<\/strong><\/em>, so that I can conveniently run the utilities without explicitly using the full path (of course, if you want, you can update the <em><strong>PATH<\/strong><\/em> variable each time the command prompt appears).<\/p>\n<p>Next, we have to run the Sicstus utility <em><strong>spld<\/strong><\/em> to generate the <em><strong>DLL<\/strong><\/em> from our source. It took me a few attempts to find out that I have to also include <em><strong>cmdproc.obj<\/strong><\/em> and <em><strong>intrpt.obj<\/strong><\/em> files to build the DLL correctly (I was getting a linker error otherwise). I created a batch file <em><strong>build-dll.bat<\/strong><\/em> to run <em><strong>spld<\/strong><\/em> with correct arguments. It is recommended to use <em><strong>&#8211;verbose<\/strong><\/em> option so that we can see the various steps in the process. I am including the transcript of the build process along with <a href=\"http:\/\/www.rangakrish.com\/downloads\/dll-example-files.zip\" target=\"_blank\" rel=\"noopener\">other files<\/a>.<\/p>\n<p>Once the process is complete, we will have the following files in the current (project) directory:<\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; train.dll<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; train.exp<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; train.lib<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; train.pdb<\/strong><\/p>\n<p>This completes the <em><strong>DLL<\/strong><\/em> creation step.<\/p>\n<h3>Using the DLL<\/h3>\n<p>Let us create a C++ program to consume the <em><strong>DLL<\/strong><\/em> just created. Here is a simple program that does this:<\/p>\n<figure id=\"attachment_1008\" aria-describedby=\"caption-attachment-1008\" style=\"width: 612px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/CPP-Example-1.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1008\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/08\/05\/sicstus-prolog-building-a-windows-dll\/cpp-example-2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/CPP-Example-1.png\" data-orig-size=\"612,725\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Consuming the DLL\" data-image-description=\"&lt;p&gt;Consuming the DLL&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Consuming the DLL&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/CPP-Example-1-253x300.png\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/CPP-Example-1.png\" class=\"size-full wp-image-1008\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/CPP-Example-1.png?resize=612%2C725\" alt=\"Consuming the DLL\" width=\"612\" height=\"725\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/CPP-Example-1.png?w=612&amp;ssl=1 612w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/CPP-Example-1.png?resize=253%2C300&amp;ssl=1 253w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><\/a><figcaption id=\"caption-attachment-1008\" class=\"wp-caption-text\"><strong>Consuming the DLL<\/strong><\/figcaption><\/figure>\n<p>As you can see, the above program dynamically loads the <em><strong>DLL<\/strong><\/em> and calls designated the entry point. Although it is possible to use the <em><strong>VS2017 IDE<\/strong><\/em> to create a project for this purpose, I chose the simpler commandline alternative. Here is the command:<\/p>\n<blockquote>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\"><strong>&gt; cl cppexample.cpp &#8220;G:\/SICStusProlog-4.4.1-VC15\/bin\/sprt4-4-1.lib&#8221; \/Fe: cppexample.exe<\/strong><\/span><\/p>\n<\/blockquote>\n<p>Notice that we have to include the <em><strong>Sicstus runtime<\/strong><\/em> library. The generated executable file is <em><strong>cppexample.exe<\/strong><\/em>.<\/p>\n<h3>Running the Program<\/h3>\n<p>Before running the program we have to ensure that the <em><strong>DLL<\/strong><\/em> we created is accessible at runtime. I copied it to the current directory where the executable is located. The other file that we need in the current directory is the saved image file <em><strong>train.sav<\/strong><\/em>.<span class=\"Apple-converted-space\">\u00a0Sicstus Prolog runtime <em><strong>DLL<\/strong><\/em>\u00a0<em><strong>sprt4-4-1.dll<\/strong><\/em> is assumed to be in the <em><strong>PATH<\/strong><\/em>.<\/span><\/p>\n<p>Here is the output from the program:<\/p>\n<figure id=\"attachment_1011\" aria-describedby=\"caption-attachment-1011\" style=\"width: 593px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Running-the-executable.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1011\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/08\/05\/sicstus-prolog-building-a-windows-dll\/running-the-executable\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Running-the-executable.png\" data-orig-size=\"593,112\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Running the Program\" data-image-description=\"&lt;p&gt;Running the Program&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Running the Program&lt;\/p&gt;\n\" data-medium-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Running-the-executable-300x57.png\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Running-the-executable.png\" class=\"size-full wp-image-1011\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Running-the-executable.png?resize=593%2C112\" alt=\"Running the Program\" width=\"593\" height=\"112\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Running-the-executable.png?w=593&amp;ssl=1 593w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Running-the-executable.png?resize=300%2C57&amp;ssl=1 300w\" sizes=\"(max-width: 593px) 100vw, 593px\" \/><\/a><figcaption id=\"caption-attachment-1011\" class=\"wp-caption-text\">Running the Program<\/figcaption><\/figure>\n<p>Nice! The program displays the paths from <em><strong>Stockholm<\/strong><\/em> to <em><strong>Orebro <\/strong><\/em>as expected. And the <em><strong>Result Code<\/strong><\/em> is zero, as it should be.<\/p>\n<p>I hope the procedure for building and using a Sicstus Prolog <em><strong>DLL<\/strong><\/em> is clear from this article. All the relevant files used in this example are available\u00a0<a href=\"http:\/\/www.rangakrish.com\/downloads\/dll-example-files.zip\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>Have a nice weekend!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I upgraded to the latest version (4.4.1) of Sicstus Prolog\u00a0for Windows.\u00a0Since the Prolog engine can be embedded (royalty free) in other applications, it is useful to understand how to create a DLL (on Windows) for this purpose. In today&#8217;s article, I would like to outline this process in sufficient detail because I found [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[49,17,147],"tags":[149,148,150],"class_list":["post-1004","post","type-post","status-publish","format-standard","hentry","category-c","category-programming","category-prolog","tag-dll","tag-prolog","tag-sicstus"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-gc","jetpack-related-posts":[{"id":1025,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/08\/19\/sicstus-prolog-building-a-windows-executable\/","url_meta":{"origin":1004,"position":0},"title":"Sicstus Prolog &#8211; Building a Windows Executable","author":"admin","date":"August 19, 2018","format":false,"excerpt":"In my previous post, I showed how to build a C-based Windows DLL to execute Prolog predicates in the Sicstus Prolog\u00a0engine. Today, I want to show how to build an executable (on Windows) from a C\/C++ program that uses Sicstus prolog engine. The process is quite simple. In order to\u2026","rel":"","context":"In &quot;Natural Language Processing&quot;","block_context":{"text":"Natural Language Processing","link":"https:\/\/www.rangakrish.com\/index.php\/category\/natural-language-processing\/"},"img":{"alt_text":"Creating WordNet Prolog Image","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Creating-image.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Creating-image.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/08\/Creating-image.png?resize=525%2C300 1.5x"},"classes":[]},{"id":1770,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/10\/calling-c-methods-from-sicstus-prolog-through-com-interface\/","url_meta":{"origin":1004,"position":1},"title":"Calling C# Methods from Sicstus Prolog through COM Interface","author":"admin","date":"November 10, 2019","format":false,"excerpt":"Recently\u00a0I needed to make use of a C# library (which I had implemented a few years ago) from Sicstus Prolog. Calling C\/C++ functions from Sicstus Prolog is fairly well documented. When it comes to C#\/.NET, the official documentation recommends the PrologBeans library. After going through the documentation, I felt that\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"Prolog Client Code","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Prolog-Code.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Prolog-Code.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Prolog-Code.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2433,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/06\/06\/getting-to-know-visual-prolog-10\/","url_meta":{"origin":1004,"position":2},"title":"Getting to Know Visual Prolog 10","author":"admin","date":"June 6, 2021","format":false,"excerpt":"Visual Prolog\u00a0has its roots in Turbo Prolog, which was popularized by Borland in the mid 1980s. It is developed and supported by PDC A\/S, Denmark. So how is Visual Prolog different from other Prolog implementations out there, for example, SWI-Prolog or Sicstus Prolog? Here are the key differences: 1) It\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Visual Prolog Project","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/06\/Project-300x183.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/06\/Project-300x183.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/06\/Project-300x183.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1757,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/10\/13\/conjugating-phrasal-verbs\/","url_meta":{"origin":1004,"position":3},"title":"Conjugating Phrasal Verbs","author":"admin","date":"October 13, 2019","format":false,"excerpt":"In the last article, I showed how to generate verb conjugations in the \"iLexicon\" system. Today, let us see how this idea can be extended to English \"phrasal verbs\". According to Wikipedia: \"a phrasal verb is a phrase such as turn down or ran into which combines two or three\u2026","rel":"","context":"In &quot;Natural Language Processing&quot;","block_context":{"text":"Natural Language Processing","link":"https:\/\/www.rangakrish.com\/index.php\/category\/natural-language-processing\/"},"img":{"alt_text":"Conjugation of \"Turn on\"","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/10\/Example3.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3260,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/11\/26\/generating-polynomials-in-prolog\/","url_meta":{"origin":1004,"position":4},"title":"Generating Polynomials in Prolog","author":"admin","date":"November 26, 2023","format":false,"excerpt":"Polynomial is an important topic in High School maths curriculum. There are many online courses that explain the topic in great details with lots of examples and sample exercises. Wouldn\u2019t it be interesting if we can generate polynomials of given degree programmatically? It turns out that this is not such\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"Generating Polynomials - Main Clauses","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/11\/Code1-300x163.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/11\/Code1-300x163.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/11\/Code1-300x163.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1677,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/08\/18\/using-berkeley-db-with-sicstus-prolog\/","url_meta":{"origin":1004,"position":5},"title":"Using Berkeley DB with Sicstus Prolog","author":"admin","date":"August 18, 2019","format":false,"excerpt":"One of the nice features of Sicstus Prolog\u00a0is the support for storing Terms\u00a0externally in a Berkeley DB\u00a0database. Since we can control how the terms are indexed in the database, it is possible to store and retrieve a large amount of Terms\u00a0(the limit is 2^32-1) fairly efficiently. This can be useful\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"Iterating Over the DB","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/08\/iterate-db.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/08\/iterate-db.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/08\/iterate-db.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=1004"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1004\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=1004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=1004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=1004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}