caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Learning about compiler-libs
@ 2015-08-07 22:25 Leonid Rozenberg
  2015-08-07 22:46 ` Gabriel Scherer
  0 siblings, 1 reply; 2+ messages in thread
From: Leonid Rozenberg @ 2015-08-07 22:25 UTC (permalink / raw)
  To: Caml List

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

Are there any resources besides the couple of blog posts and reading the
source?

I found this surprising:

        OCaml version 4.02.1

# #use "topfind" ;;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

- : unit = ()
# #require "compiler-libs.toplevel" ;;
/Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs: added to
search path
/Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs/ocamlcommon.cma:
loaded
/Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs/ocamlbytecomp.cma:
loaded
/Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs/ocamltoplevel.cma:
loaded
# let a x = x + 1 ;;
>> Fatal error: a unbound at toplevel
Fatal error: exception Misc.Fatal_error

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

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

* Re: [Caml-list] Learning about compiler-libs
  2015-08-07 22:25 [Caml-list] Learning about compiler-libs Leonid Rozenberg
@ 2015-08-07 22:46 ` Gabriel Scherer
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Scherer @ 2015-08-07 22:46 UTC (permalink / raw)
  To: Leonid Rozenberg; +Cc: Caml List

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

The short answer is: no, there is no documentation.

The long answer: compiler-libs was made available following the demand of
expert users, that were already familiar with the compiler codebase,
willing to reuse its internals to develop tooling around the language.
Nobody had the time back then to contribute a comprehensive documentation,
or even to define a reasonable API subset to expose (so basically
everything is exposed). Finally, there is no guarantee of API compatibility
across OCaml versions, so reusing this makes you tightly coupled to the
compiler evolution.

Documentation emerges slowly under the form of blog posts, discussions, and
evolution of the codebase. In particular, over the course of his work on
-ppx, Alain Frisch enriched parsing/parsetree.mli with invaluable comments
describing the mapping between concrete and abstract syntax. Everyone is
warmly welcome to contribute such improvements to the (codebase)
documentation.

On Sat, Aug 8, 2015 at 12:25 AM, Leonid Rozenberg <leonidr@gmail.com> wrote:

> Are there any resources besides the couple of blog posts and reading the
> source?
>
> I found this surprising:
>
>         OCaml version 4.02.1
>
> # #use "topfind" ;;
> - : unit = ()
> Findlib has been successfully loaded. Additional directives:
>   #require "package";;      to load a package
>   #list;;                   to list the available packages
>   #camlp4o;;                to load camlp4 (standard syntax)
>   #camlp4r;;                to load camlp4 (revised syntax)
>   #predicates "p,q,...";;   to set these predicates
>   Topfind.reset();;         to force that packages will be reloaded
>   #thread;;                 to enable threads
>
> - : unit = ()
> # #require "compiler-libs.toplevel" ;;
> /Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs: added to
> search path
> /Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs/ocamlcommon.cma:
> loaded
> /Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs/ocamlbytecomp.cma:
> loaded
> /Users/leonidrozenberg/.opam/4.02.1/lib/ocaml/compiler-libs/ocamltoplevel.cma:
> loaded
> # let a x = x + 1 ;;
> >> Fatal error: a unbound at toplevel
> Fatal error: exception Misc.Fatal_error
>

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

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

end of thread, other threads:[~2015-08-07 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 22:25 [Caml-list] Learning about compiler-libs Leonid Rozenberg
2015-08-07 22:46 ` Gabriel Scherer

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).