ekdohibs / camlboot Goto Github PK
View Code? Open in Web Editor NEWExperiment on how to bootstrap the OCaml compiler
License: MIT License
Experiment on how to bootstrap the OCaml compiler
License: MIT License
Before even considering reproducing a debootstrap experiment, I would want to know how long it's going to take, or at least how long it took for people who did it in the past. I complain about other projects not providing this information, but we don't either. I'm opening this issue to track this: we should include complete build time on someone's machine directly in the README.
Excellent project! I modified the OCaml-based interpreter to provide dynamic program traces in order to build a live programming environment for OCaml (unexplained teaser screenshot below).
I would like to know how to cite this project. Would you be able to add a CITATION.cff file? Or at least, how should I write the author list for citing the interpreter written in OCaml?
Thanks a bunch. Camlboot is excellent work that saved me weeks if not months of time!
This is exciting. I have been wondering about bootstrapping Ocaml for a while. I have not test build yet but I saw this is able to build ocamlc.
What are you opinions about transforming the code into scheme somehow, in order to bootstrap of a basic scheme interpreter written in C?
The reason I suggest scheme is that macros enable us to manipulate the scheme language to be much more like ocaml in all ways except the surface syntax.
Hi!
I've started working on porting camlboot to ocaml 4.09 and I'm having some issues. Guix still has ocaml 4.09, so that's why it felt like the natural next step. I guess I would have more issues if I tried to port to the latest OCaml anyway :)
I managed to build generated files like the lexer and parser. I had to assume menhir was available (bootstrapped from ocaml 4.07 :D, and we need to copy its menhirLib.{ml,mli} into boot/menhir
in ocaml's source directory), changed some file locations when they moved to another place in ocaml's sources and fixed some issues with building ocamllex. I created a branch at https://github.com/roptat/camlboot/tree/4.09 and at https://github.com/roptat/ocaml/tree/4.09-camlboot. I had to implement a few missing primitives and fix interpreter/interp.ml
to load ocaml's sources properly.
Now I can run make _boot/ocamlc
and it builds up to interp.byte. However, when running it I get this error:
./interp -nopervasives -nostdlib -w -20-21 -I ../../interpreter -c stdopt.mli
Code raised exception: Assert_failure#7 (, 0, 0)
which doesn't help figuring out what went wrong :/
If it helps, I get the same error with no arguments, like ./interp
, in about the same time so I guess the issue happens very early in OCaml's initialization.
Any ideas would be appreciated :)
Since I pushed camlboot to Guix, we kinda need to support the platform it supports (well, I can also fix that by not using camlboot on i686). Here is the error I get (see https://ci.guix.gnu.org/build/18557/log/raw):
mkdir -p lex/
../../ocaml-src/byterun/ocamlrun lex.boot.byte ../../ocaml-src/lex/lexer.mll -o lex/lexer.ml
Fatal error: exception Failure("input_value: object too large to be read back on a 32-bit platform")
make[1]: *** [Makefile:28: lex/lexer.ml] Error 2
Is this an issue with lex.boot.byte
(because we maybe only create bytecode for 64 bit architectures), or with lexer.mll
(because maybe it creates huge objects)?
cd camlboot
and extract the ocaml-4.07.0
source release to this directory. Edit the following lines of interp.ml
(they must be absolute paths, relative paths will not work):
[1202] let stdlib_path = "/path/to/camlboot/ocaml-4.07.0/stdlib"
[1344] let compiler_path = "/path/to/camlboot/ocaml-4.07.0"
Make a copy of ocaml-4.07.0/utils/profile.ml
called ocaml-4.07.0/utils/profile.ml.noprof
and add the following to line 99 of (disables profiling that uses unsupported features of the interpreter)
let record_call ?(accumulate = false) name f = f ()
You should be able to build interp
now with make
. btu you'll need to get get into the ocaml-4.07.0
directory to build some files to actually run it:
bash configure
( cd stdlib/ ; make sys.ml )
make utils/config.ml
make ocamlyacc ; cp yacc/ocamlyacc boot/ ; make parsing/parser.ml
make CAMLLEX=ocamllex CAMLRUN=ocamlrun parsing/lexer.ml
make bytecomp/runtimedef.ml
make CAMLLEX=ocamllex CAMLRUN=ocamlrun CAMLC=ocamlc bytecomp/opcodes.ml
Back to camlboot
. If all was successful ./interp
should print a newline and exit. You can also make interpopt
. Now to build the standard library (you might want to enable parallel building for this export MAKEFLAGS='-j 8'
):
export CAMLC=`pwd`/interpopt
cd ocaml-4.07.0/stdlib/
touch ../ocamlc
chmod +x ./Compflags
make CAMLC=$CAMLC CAMLRUN=ocamlrun
echo 'print_string "Hello world!\n";;' > hw.ml
./interpopt -nostdlib -I ./ocaml-4.07.0/stdlib hw.ml
ocamlrun ./a.out
Try the infix branch, and run compile.scm
. You will get a warning %% Reduce/Reduce conflict (reduce 84, reduce 48) on 'RPAREN' in state 96
. I don't know the source of the conflict.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.