caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] 100-line compiler written in OCaml using LLVM reloaded
@ 2017-04-04 23:42 Jon Harrop
  2017-04-05  2:24 ` Emilio Jesús Gallego Arias
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Harrop @ 2017-04-04 23:42 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]

About 10 years ago I wrote this 100-line compiler for fun:

 

https://groups.google.com/forum/#!msg/fa.caml/i6IgSFX8XkY/4khF8z1V7loJ

 

I thought it would be cool to bring it back from the dead but I quickly got
stuck. I now have Opam, OCaml 4.03 and LLVM 4.0 installed on an Ubuntu box
and (I assume) running.

 

The first problem I hit is how I am supposed to build such things these
days. I tried to look it up on the developer tools page:

 

https://ocaml.org/learn/tutorials/dev_tools.html

 

But I immediately hit a bug on that page: The "under construction" gif isn't
properly animated. It should look like this, of course:

 

https://camo.githubusercontent.com/4a7cf94aedbd23c13cc2d75fdc3b2af5c816c208/
687474703a2f2f7374617469632e646967672e636f6d2f7374617469632f696d616765732f64
69676765722e676966

 

After the GIF I must say I found type is text data matches file from the
section on Plumbimg really useful.

 

Someone should really add an obituary for the author of the "Compilation
tools" section who sadly passed away before completing it. I leafed through
the section headings there, noted that Oasis is inspired by Cabal and
quickly crossed it off my list and decided to go with "ocamlbuild" instead.

 

If I do:

 

ocamlbuild miniml.byte

 

Then I get an error about my parser. I'm guessing this is because I used an
inline parser courtesy of camlp4 (or camlp5, I forget which) which has been
replaced with PPX which, I'm guessing, cannot do this. If so, what is the
easiest way to get this code running and how should I be building it?

 

Cheers,

Jon.

 


[-- Attachment #2: Type: text/html, Size: 4553 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] 100-line compiler written in OCaml using LLVM reloaded
  2017-04-04 23:42 [Caml-list] 100-line compiler written in OCaml using LLVM reloaded Jon Harrop
@ 2017-04-05  2:24 ` Emilio Jesús Gallego Arias
  2017-04-26 11:58   ` Jacques-Pascal Deplaix
  0 siblings, 1 reply; 3+ messages in thread
From: Emilio Jesús Gallego Arias @ 2017-04-05  2:24 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list, jon

Dear Jon,

"Jon Harrop" <jdh302@jdh302.plus.com> writes:

> The first problem I hit is how I am supposed to build such things these
> days. I tried to look it up on the developer tools page:

> Then I get an error about my parser. I'm guessing this is because I used an
> inline parser courtesy of camlp4 (or camlp5, I forget which) which has been
> replaced with PPX which, I'm guessing, cannot do this. If so, what is the
> easiest way to get this code running and how should I be building it?

using opam this:

$ ocamlfind ocamlc -g -dtypes -syntax camlp4o -package camlp4.extend -package llvm miniml.ml -o miniml

works for me, well, almost, as I get:

File "miniml.ml", line 54, characters 30-39:
Error: This expression has type Llvm.llbasicblock
       but an expression was expected of type Llvm.llcontext

but I guess this is due to the llvm version on my system.

Best,
Emilio

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] 100-line compiler written in OCaml using LLVM reloaded
  2017-04-05  2:24 ` Emilio Jesús Gallego Arias
@ 2017-04-26 11:58   ` Jacques-Pascal Deplaix
  0 siblings, 0 replies; 3+ messages in thread
From: Jacques-Pascal Deplaix @ 2017-04-26 11:58 UTC (permalink / raw)
  To: Emilio Jesús Gallego Arias, Jon Harrop, caml-list, jon

[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]

Hi,

If you still want to have something that works using ocamlbuild, a recent
OCaml version and a recent LLVM version, I managed to get something out of
it. Nothing that was too complicated but still..

I put the result here: https://github.com/jpdeplaix/harrop-minml

Cheers,

Le mer. 5 avr. 2017 à 04:26, Emilio Jesús Gallego Arias <e@x80.org> a
écrit :

> Dear Jon,
>
> "Jon Harrop" <jdh302@jdh302.plus.com> writes:
>
> > The first problem I hit is how I am supposed to build such things these
> > days. I tried to look it up on the developer tools page:
>
> > Then I get an error about my parser. I'm guessing this is because I used
> an
> > inline parser courtesy of camlp4 (or camlp5, I forget which) which has
> been
> > replaced with PPX which, I'm guessing, cannot do this. If so, what is the
> > easiest way to get this code running and how should I be building it?
>
> using opam this:
>
> $ ocamlfind ocamlc -g -dtypes -syntax camlp4o -package camlp4.extend
> -package llvm miniml.ml -o miniml
>
> works for me, well, almost, as I get:
>
> File "miniml.ml", line 54, characters 30-39:
> Error: This expression has type Llvm.llbasicblock
>        but an expression was expected of type Llvm.llcontext
>
> but I guess this is due to the llvm version on my system.
>
> Best,
> Emilio
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-26 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 23:42 [Caml-list] 100-line compiler written in OCaml using LLVM reloaded Jon Harrop
2017-04-05  2:24 ` Emilio Jesús Gallego Arias
2017-04-26 11:58   ` Jacques-Pascal Deplaix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).