Now, I want to create a very tiny Prolog compiler. But, I don't know much about a tiny compiler.
Can you help me to write a very tiny Prolog compiler? Please don't delete or close this question.
I will use your code for my private programming learning only. So, please keep your source code be private. (see at the end of this question: Note.)
Your own compiler must works as these features:
- Simple as these code (http://ift.tt/1ImnCm8, or http://ift.tt/1KNGMqM) only: (as in Description section).
- Allow space insensitive.
- Some replaces for syntax rules:
- Connection (is comma) (,) is replaced by star (*).
- Djsjuntion (is semicolon) (;) is replaced by plus (+).
- Rule (is :-) (:-) is replaced by colon (:).
- Query/question (is ?-) is replaced by question mark (?).
- Lexical scope: global.
- Allow these variables: _ABC, abc, Abc ...
- Allow use brackets (such as: ()) to change the order of precedence.
- Cut and list are not required.
- String type is not required.
- Show all possible solution.
Your code must be:
- Written in PHP, and compatible with PHP 4, PHP 5.
- Please don't write your code in object oriented programming.
- Your code be tested with QuickPHP).
- Please don't test your code with online IDEs, such as: ideone.com, eval.in ...
Here is my own HTML interface:
<?php
$source_code_box = $_POST['source_code_box'];
?>
<form action="compiler.php">
<textarea name="source_code_box"></textarea>
<br />
<input type="submit" name="compile_button" />
</form>
<hr />
<?php
yourfunction($source_code_box);
?>
Here are some useful source code:
- http://ift.tt/1KNGMqM (in Object-J)
- http://ift.tt/1KNGNLC (in JavaScript)
- http://ift.tt/1ImnBi2 (in JavaScript)
- http://ift.tt/1KxzeFU (in Perl)
- http://ift.tt/1ImnCma (in Pascal)
- http://ift.tt/1KNGNLE (in JavaScript)
Sorry about my English, it is so bad. If my question is not clear, please comment bellow this question.
Note: Your complete source code must be uploaded, at here (http://ift.tt/1ImnBi6). Then, if your file is uploaded, it will return an MD5 string. Please copy this MD5 string, and paste it into Stack Overflow as your answer. I will read your code later, and give my own 500 score bounty for you.
Aucun commentaire:
Enregistrer un commentaire