Ask for info of the source code internals

70 views
Skip to first unread message

dylan.wen

unread,
Nov 10, 2014, 12:05:06 PM11/10/14
to jo...@googlegroups.com
Hi,

There is a dir "src/ast" in the github source directories of Joxa. It
contains some .ast files which seem to be Core Erlang AST codes. Are
those .ast files generated by some other source files? where could I
find the readable source code or any documentation of them?

Any comment or further information about the internals or the build
process of the Joxa source code is appreciated.

Thanks,
Dylan

Eric Merritt

unread,
Sep 1, 2015, 5:21:28 PM9/1/15
to joxa
Dylan,

  Joxa is bootstrapped at the moment. Its a bit of a chicken and an egg problem. Joxa compiles Joxa, so in a new implementation we need a way to compile the Joxa code when there is no Joxa installed. So that ast directory contains the Joxa compiler compiled to core Erlang ast.

I am seriously considering moving away from that model. Its a great model, but it is limiting in various ways. One of those ways is the understandability of the system.

Sorry for the slow response,
Eric

Dylan Wen

unread,
Sep 5, 2015, 11:05:57 PM9/5/15
to Eric Merritt, joxa
Hi Eric,

Thank you for the response. After I raised this question last year, I took a deep dig into the source code and I think I have figured out some bits of the internals. And then I added the map syntax support for Joxa and raised the PR in github, although it took a long time for me.

self-bootstrapping is great. IMO, it would be better to make it self-bootstrap after the language itself has stabilized. If the language is still young and changes frequently, self-bootstrapping would make it hard for development and debugging.

Dylan

在 15/9/2 05:21, Eric Merritt 写道:
--
You received this message because you are subscribed to the Google Groups "joxa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joxa+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Merritt

unread,
Sep 6, 2015, 12:36:37 AM9/6/15
to Dylan Wen, joxa
Agreed. Robert gave me the same advice. I should have taken it.

I actually just started a rewrite of the compiler in Erlang. I needed
to do that anyway to target Erlang AST instead of Core AST. Thats
needed because I dialyzer can't pick up specs from core erlang only
from erlang.

My current plan is

* Rewrite lexer, dropping neotoma (neotoma is very very slow and a
lisp lexer s pretty simple).
* Rewrite the parser in erlang
* Write the Joxa AST -> Erlang AST compiler
* Split out Joxa core (the joxa files themselves) from the joxa compiler itself.

I will post an in-progress PR, so folks can follow.

I am also going to merge the master and next branches and drop the
next branch. There should only be one point of development.

Eric

Dylan Wen

unread,
Sep 6, 2015, 3:37:41 AM9/6/15
to Eric Merritt, joxa
The plan sounds good. We could focus on rewriting the compiler in Erlang
currently, and leave the standard library(core, lists, otp support,
etc.) for later(these library codes probably should be written in Joxa).

It would be good if you keep updates on the progress, I am happy to see
the source code and catch up.

BTW, I found it's hard to search any document of Erlang AST. Do you know
anywhere online I could read or download any document of Erlang AST?

Dylan

在 15/9/6 12:36, Eric Merritt 写道:

Eric Merritt

unread,
Sep 7, 2015, 1:30:49 PM9/7/15
to Dylan Wen, joxa
I will do it. I will need to find a reviewer anyway. Jordan (my normal
reviewer) hasn't been connected to this project for a bit.

There is no good documentation. You essentially have to write the
erlang code you think you want to produce and then convert it to an
ast to see what to produce.

I wrote some utilities to support that:
https://github.com/joxa/joxa/blob/master/src/jxa_utils.erl.

Dylan Wen

unread,
Sep 21, 2015, 7:30:49 AM9/21/15
to Eric Merritt, joxa

I find some docs about Erlang AST occasionally when I try to search some docs about these erl_scan, erl_parse, compile modules.

ERTS User’s Guide - 6 The Abstract Format

Anyway I will still convert the Erlang source code to AST for confirmation.

在 15/9/8 01:30, Eric Merritt 写道:

Reply all
Reply to author
Forward
0 new messages