Python代写 | Implement a Prolog interpreter in OCaml or Python

本次美国代写主要为利用OCaml和Python实现Prolog解释器

A Prolog interpreter
In this project, you will implement a Prolog interpreter in OCaml or Python.
Compile and run your code:
OCaml
After downloading and unzipping the file for the final project, in your command-line window, cd into the directory which contains src . You should write your
code in src/final.ml . The test-cases (also seen below) are provided in src/main.ml .
Use make to compile the code. And use ./final to excute it.
Python
After downloading and unzipping the file for the final project, in your command-line window, cd into the directory which contains src . You should write your
code in src/final.py . The test-cases (also seen below) are provided in src/main.py . Data structures are provided in src/prolog_structures.py .
Use python3 src/main.py to execute your code. Please do not use python2 .
Submission:
Please submit to Sakai final.ml or final.py only.
Important notes about grading:
Programs that cannot be compiled will receive an automatic zero. If you are having trouble getting your assignment to compile, please visit recitation or office
hours.

Problem 1, Problem 2: 4 points each
Problem 3, Problem 4: 11 points each
Challenge problem: 5 points
Pseudocode
The pseudocode of Problem 3 and 4 is given in the lecture note Control in Prolog .
Abstract Syntax Tree
To implement the abstract interpreter, we will start with the definition of prolog terms (i.e. abstract syntax tree).