Re: [julia-users] Implementing compilers or interpreters in Julia?

2016-09-22 Thread Tim Besard
Op donderdag 22 september 2016 12:55:01 UTC-4 schreef Isaiah:

> - Cxx.jl, if you want to target LLVM
>

I've been working on LLVM.jl to make this even easier:
- https://github.com/maleadt/LLVM.jl
- irbuilder + execution example: 
https://github.com/maleadt/LLVM.jl/blob/master/examples/sum.jl

Is going to be used to power CUDAnative, see e.g. 
https://gist.github.com/maleadt/ec07509c880903efce0d2fed6bded416

Tim



Re: [julia-users] Implementing compilers or interpreters in Julia?

2016-09-22 Thread Isaiah Norton
Any answer if going to be fairly opinion-based. That said, here are some
opinions :)

some advantages:
- interactive development
- performance
- Cxx.jl, if you want to target LLVM
- multiple dispatch

some disadvantages:
- lack of ML-style pattern-matching -- though multiple dispatch on node
type covers much of how this is used (and
https://github.com/kmsquire/Match.jl might help too)
- for an interpreter, lack of static compilation (your language would need
to carry along Julia and LLVM machinery)

Some examples of compiler-related-things written in Julia:

- Intel's ParallelAccerator compiler:
https://github.com/IntelLabs/ParallelAccelerator.jl
- Julia's type inference:
https://github.com/JuliaLang/julia/blob/master/base/inference.jl
- Julia parser: https://github.com/JuliaLang/JuliaParser.jl

- "green-fairy", an abstract interpreter:
https://github.com/carnaval/green-fairy
   (MS thesis project, see PDF report. still WIP)
- parsers for object-file formats (DWARF, COFF, MachO, ...):
https://github.com/Keno?tab=repositories=source
- https://github.com/JuliaGPU/CUDAnative.jl
- https://github.com/swadey/LispSyntax.jl
- https://github.com/andrewcooke/ParserCombinator.jl
- https://github.com/abeschneider/PEGParser.jl
- BF interpreter: https://github.com/johnmyleswhite/Brainfuck.jl



On Wed, Sep 21, 2016 at 8:29 PM, Sebastian the Eight <
imperator.ozymand...@gmail.com> wrote:

> I'm curious how adept Julia is for writing compilers/interpreters? It's
> fairly easy to find example toy compilers for most other languages (C,
> OCaml, Ruby etc), but Julia seems to be lacking any examples except for its
> own. I was wondering if there are advantages or disadvantages for using
> Julia in this way, other than being a relatively new language