Julia implementation

320 views
Skip to first unread message

Ford Ox

unread,
May 24, 2016, 10:24:33 AM5/24/16
to julia-users
Docs state that most of the julia language is implemented in julia itself.
What is not implemented in julia?
What language is it implemented in? (I think that arrays come from c, right?)
Why is it implemented in that particular language?

Isaiah Norton

unread,
May 24, 2016, 10:56:15 AM5/24/16
to julia...@googlegroups.com
I would suggest to read src/README.md and the Devdocs (http://docs.julialang.org/en/latest/devdocs/julia/) for an overview of the organization of the codebase.
 
What is not implemented in julia?
What language is it implemented in? (I think that arrays come from c, right?)

- frontend (parsing and lowering): small Scheme variant called flisp, also written by Jeff Bezanson
- runtime (primitives, allocation, GC): C
- code generation: C++
- various libraries are written in C, Fortran, etc. (PCRE, BLAS, GMP, libgit2, ...)

Why is it implemented in that particular language?

- C: because is the lowest-common-denominator for system implementations.
- C++: because it is the most straight-forward way to interface with LLVM.
- Scheme: because Julia is a Trojan Horse to finally make the world use Lisp. because it keeps the pesky peasants out. because it's a great compiler language and allowed fast implementation and iteration. There is some interest in moving the front end to pure Julia, and the parser has been ported already (JuliaParser.jl) -- that's about ~1/3 of the job. Porting the lowering and sorting out bootstrapping is a fair amount of effort and would likely need to be done by people who could be making more user-relevant improvements elsewhere. So far, doing so hasn't been a priority.

cormu...@mac.com

unread,
May 24, 2016, 10:57:04 AM5/24/16
to julia-users
Click on the colored bar on the main page: https://github.com/JuliaLang/julia

The current percentage is 66.5% Julia. 2//3...

There's some plumbing in C, and the parsing's in Scheme.

Stefan Karpinski

unread,
May 24, 2016, 11:04:12 AM5/24/16
to Julia Users
On Tue, May 24, 2016 at 10:56 AM, Isaiah Norton <isaiah...@gmail.com> wrote:
 
- Scheme: because Julia is a Trojan Horse to finally make the world use Lisp. because it keeps the pesky peasants out. because it's a great compiler language and allowed fast implementation and iteration. There is some interest in moving the front end to pure Julia, and the parser has been ported already (JuliaParser.jl) -- that's about ~1/3 of the job. Porting the lowering and sorting out bootstrapping is a fair amount of effort and would likely need to be done by people who could be making more user-relevant improvements elsewhere. So far, doing so hasn't been a priority.

There's something delightful about the fact that in order to change the syntax of Julia, you must first prove yourself proficient in a language that actively rejects the very concept of fancy syntax.

Didier Verna

unread,
May 24, 2016, 11:25:24 AM5/24/16
to Stefan Karpinski, Julia Users
Stefan Karpinski wrote:

> There's something delightful about the fact that in order to change
> the syntax of Julia, you must first prove yourself proficient in a
> language that actively rejects the very concept of fancy syntax.

:-D :-D :-D

--
Resistance is futile. You will be jazzimilated.

Lisp, Jazz, Aïkido: http://www.didierverna.info

Ford Ox

unread,
May 24, 2016, 12:47:19 PM5/24/16
to julia-users
Thank you very much.

One more question : Is there any speed to gain, when all that stuff would be rewritten in the lowest possible language? (I guess that is assembler or machine code :D)

Stefan Karpinski

unread,
May 24, 2016, 12:57:37 PM5/24/16
to Julia Users
Rewriting the parser in C would (probably) make it faster. So would compiling it using e.g. the recently-open-sourced ChezScheme, which is a less drastic measure.

Scott Jones

unread,
May 25, 2016, 7:32:43 AM5/25/16
to julia-users
From my own experiences, while I do believe rewriting it in C would make it faster, a much better option would be to adapt JuliaParser.jl.  Last year right when I first started with Julia, I thought I'd need to implement most of code that was performance critical (at least for me) in C, and call that from Julia (and was following examples in Julia itself where C is used).  However, I got schooled by some of the top Julia contributors (in particular Tony Kelman), that well-written, readable Julia code can still be as fast as C, and I have the microbenchmarks (about Unicode string conversions) to prove it.
Jeff recently told me that the parser actually isn't the biggest issue with replacing Scheme with Julia, it's rather the lowering code.
It would be nice to see that ported to Julia, and then do some performance comparisons.

Replacing all of the Scheme code with Julia (and moving more of the lower level stuff for Unicode from C to Julia) I think would greatly help allowing more contributors to work on the core language,
as it is, mad skillz are needed in Julia, Scheme, C, C++, and LLVM IR to work across the board.
Reply all
Reply to author
Forward
0 new messages