Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple fixes #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Simple fixes #1

wants to merge 3 commits into from

Conversation

evaporei
Copy link

I've thinking about learning OCaml and write myself a Brainfuck interpreter, so this has been helpful, thanks!

I just had a couple of issues running this project:

Compilation

Even though I could compile the .mli file, it had different signatures than the implementation one, I've got this error:

otaviopace@Otavios-MacBook-Pro ~/ml-brainfuck (master)> ocamlopt -c brainfuck.ml
File "brainfuck.ml", line 1:
Error: The implementation brainfuck.ml
       does not match the interface brainfuck.cmi:
       Values do not match:
         val interpret : ?tape_size:int -> ?format:string -> string -> unit
       is not included in
         val interpret : string -> string
       File "brainfuck.mli", line 2, characters 0-32: Expected declaration
       File "brainfuck.ml", line 17, characters 4-13: Actual declaration

Screen Shot 2021-05-22 at 10 36 14

So I've fixed the interface file 😉

hello.txt example

This example had the name of the file inside it, and since it has an extension, the . could be interpreted as part of the program, so I made it similar to the other examples where the name is before the content.

Wrong outputs

In README.md it was saying the output would be 100, but it was 50 and 40, like shown below:

otaviopace@Otavios-MacBook-Pro ~/ml-brainfuck (master)> ocaml brainfuck.ml sample.bf -fmt integer
50⏎                                                                                                                                                                                                                 otaviopace@Otavios-MacBook-Pro ~/ml-brainfuck (master)> echo '++++ [> +++++ +++++ < - ] > .' | ocaml brainfuck.ml -fmt integer
40

Screen Shot 2021-05-22 at 10 39 38

So I've fixed the outputs on README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant