[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [potluck dish] Compiler for the Joy language
From: |
Nala Ginrut |
Subject: |
Re: [potluck dish] Compiler for the Joy language |
Date: |
Thu, 18 Feb 2016 13:04:39 +0800 |
I'm glad to see a new language implemented on Guile!
IMO, the language project could be out of Guile core, and it's easier to
maintain or apply patches.
Thanks!
On Mon, 2016-02-15 at 22:17 -0600, Eric Bavier wrote:
> Hello Guilers,
>
> And happy birthday Guile!
>
> I started this project a few weeks ago, and managed to make enough
> progress that I thought I'd share it for the potluck.
>
> Joy is a simple, forth-like, purely functional, concatenative
> programming language:
>
> https://en.wikipedia.org/wiki/Joy_(programming_language)
> http://www.latrobe.edu.au/humanities/research/research-projects/past-projects/joy-programming-language
>
> Attached is a patch to guile master that adds a module/language/joy
> directory, with lexer, parser, compiler to tree-il, runtime, and minimal
> standard library. This is still a work-in-progress, but you can already
> do some fun things:
>
> $ guile
> scheme@(guile-user)> ,L joy
> joy@(guile-user)> "<path-to>/base.joy" include .
> joy@(guile-user)> 2 3 + 4 1 .
> $1 = (1 4 5)
> joy@(guile-user)> DEFINE foo == 2 3 + 4 1 ; bar == + + .
> joy@(guile-user)> foo bar .
> $2 = (10)
> joy@(guile-user)> [1 2 3 4 5 6] [fact] map .
> $3 = ((1 2 6 24 120 720))
> joy@(guile-user)> [1 2 3 4 5 6] [fact] map sum .
> $4 = (873)
> joy@(guile-user)> [1 2 3 4 5 6] [fact 2 /] map .
> $5 = ((0 1 3 12 60 360))
>
> My interest in Joy came from a search to find a small language whose
> minimal base could be implemented as an easily-audited assembly
> interpreter, but which has higher-level language capabilities. The
> guile implementation sprang out of a desire to get to know the language
> a bit more before embarking on the assembly route. Learning more about
> Guile's multi-language support has been a real pleasure, and I'd love
> to see it/help it grow more.
>
> Limitations and things yet to do:
>
> - The compiler and runtime currently do not support "sets" aka bitsets
> as a native type like the reference implementation does.
>
> - String support in the primitives and base library is not complete. I
> have been toying with the idea of just compiling strings to
> lists-of-chars for easier handling and simplicity of the primitives.
>
> - REPL: A joy-specific writer would be nice. And better backtraces?
>
> - Writing more interesting libraries. I had hoped to write a useful
> parser-combinator library.
>
> - Better include-path handling.
>
> - Distribution: part of Guile, or separate?
>
> Anyhow, I hope some find this interesting.
>
> Happy Hacking and happy birthday Guile!
> `~Eric Bavier