You are not logged in.
I've been mooching around with language design as of late. So far I've written several in Python and a mediocre one in C++ — but there was no challenge in doing so. The only way I could prove my skills to myself was to write a language purely in C.
Which I did.
The language is called punt (all-lowercase), simply because it's a cool name. It consists of an interpreter and a set of modules. Note that while the syntax may vaguely resemble that of Lisp/Scheme, there are few other similarities.
The interpreter
This is a tokenizer/parser and an engine glued together. All non-essential functionality is contained in punt "modules", which are .so's conforming to a specific API — basically your standard C library.
The modules
These are the language's libraries; each one is designed for a specific category of functions. They can be loaded with the interpreter's built-in function use. I'm still in the process of writing them, so punt isn't particularly functional at the moment.
Hello World
(note that these examples are likely to get out of date as I/we rework the language)
# simple way
(use 'io')
(fput (stdout) 'Hello, world!\n')
# slightly more complex way
(use 'io' 'flow')
(.hello_world (func .(last
(.hwstr 'Hello, world!\n')
(fput (stdout) hwstr) )))
(hello_world)
punt is a work in progress, but I have high hopes for it.
Developers
* Myself
* Ghost1227
Links
Project website
AUR package: being maintained by the awesome Ghost1227
github: where teh source codez be @
Logos
Everyone go worship Xyne for being totally awesome.
Last edited by Peasantoid (2009-06-21 16:26:15)
Offline
Sounds totally awesome! Whatever you do stick to your design of keeping it minimal, that makes it even better
You said it doesn't have similarities to lisp other than using s-expressions, would it be possible to implement lisp like constructs via modules?
Why am I asking you! I can just go look at the code!
Offline
would it be possible to implement lisp like constructs via modules?
What do you mean by this? (My apologies, my Lisp experience == nil.)
Great to see you're enthusiastic!
# Update: starting work on the math module.
Last edited by Peasantoid (2009-06-12 02:44:20)
Offline
HashBox wrote:would it be possible to implement lisp like constructs via modules?
What do you mean by this? (My apologies, my Lisp experience == nil.).
I'm not actually all that sure, my lisp experience is pretty close to nil also, but I just wonder to what extent the modules can modify things really. I suppose if a module can read in an s-expression and spit one back out that would be enough to implement a lisp
Offline
I see... Yes, that is within the capabilities of the module system. Because of C's dynamic typing (praise the gods of computing for void pointers), they can do pretty much anything they want with data.
Offline
I see... Yes, that is within the capabilities of the module system. Because of C's dynamic typing (praise the gods of computing for void pointers), they can do pretty much anything they want with data.
Well that's really nice work man, I look forward to playing around with it
Offline
Well that's really nice work man
Thanks!
/me likes praise
N.B. The API might be a little confusing... you should take a look at one of the existing modules for ideas.
Last edited by Peasantoid (2009-06-12 03:31:18)
Offline
Here's my opinion... http://aur.archlinux.org/packages.php?ID=27192
Offline
Here's my opinion... http://aur.archlinux.org/packages.php?ID=27192
Dude, thanks! I didn't even think of AUR'ing it.
Offline
I've completed the 'math' module. It defines all but the most esoteric functions in the C standard library's math.h.
Interesting thing I discovered: you have to pass '-lm' to GCC in order to get it to link with the math functions. Does anyone know why this isn't in libc?
Offline
Interesting thing I discovered: you have to pass '-lm' to GCC in order to get it to link with the math functions. Does anyone know why this isn't in libc?
I've encountered this before, it's one of those things that make you go "huh?". Nice work on getting the math module done
As a suggestion, it would be useful to have a module which allows loading and running arbitrary functions from shared libraries, although I'm not too sure where to start with implementing this, I think there is a library around that allows you to do this fairly easily, but I can't seem to find it right now. But as a relatively new scripting language something like this would make it easier to interact to common libraries while other modules are still being written.
Edit: Obviously I was searching for the wrong thing, what I'm talking about is a foreign function interface
Last edited by HashBox (2009-06-13 01:43:44)
Offline
As a suggestion, it would be useful to have a module which allows loading and running arbitrary functions from shared libraries, although I'm not too sure where to start with implementing this, I think there is a library around that allows you to do this fairly easily, but I can't seem to find it right now. But as a relatively new scripting language something like this would make it easier to interact to common libraries while other modules are still being written.
Edit: Obviously I was searching for the wrong thing, what I'm talking about is a foreign function interface
A foreign function interface would be an interesting thing to implement, but is not currently on the list of priorities — maybe you could try your hand at it? My focus is on the bare essentials, such as flow control (which is still incomplete).
Offline
A foreign function interface would be an interesting thing to implement, but is not currently on the list of priorities — maybe you could try your hand at it? My focus is on the bare essentials, such as flow control (which is still incomplete).
That's fair enough, I would try it but I'm not too sure where to start with the FFI thing. I'll give it another look in about a weeks time (ultra busy with schoolwork at the moment).
Offline
As long as the foreign function to be called doesn't accept any arguments, you could just dlopen() + dlsym() and return the function pointer as a custom type ('ffi_func' would do) that can be executed by a function called, for example, 'ffi_exec'.
But I doubt any particularly useful function is going to have 0 args...
Last edited by Peasantoid (2009-06-13 05:06:05)
Offline
New module: 'cmp'. Functions for comparing values.
Next on the list is 'str'.
Offline
I've added punt to the Arch Linux Programming Language Logos thread.
I modelled the svg on the logo on the site but it was difficult due to its size. I also used a little artistic license so it isn't an exact match. If you have an official svg I'll redo the logos using that. If you don't have an svg image yet, you can use the one that I created as a base: http://xyne.archlinux.ca/img/xyne_misc/punt_logo.svg
with semi-transparency:
svg: http://xyne.archlinux.ca/img/logos/arch-punt_logo.svg
without semi-transparency:
svg: http://xyne.archlinux.ca/img/logos/arch-punt_logo_2.svg
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Whoa Xyne, nice! Did you use Inkscape for that?
Offline
Whoa Xyne, nice! Did you use Inkscape for that?
Thanks. Yeah, I've used Inkscape for all the logos in that thread.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Offline
Wow, brilliant! Keep up the good work.
Is it a known issue that if the last line of the source file contains code, but does not end with a newline, that line won't be parsed?
Offline
Is it a known issue that if the last line of the source file contains code, but does not end with a newline, that line won't be parsed?
Just tested this and it is confirmed. Will get right on it.
Yay, 1st bug report!
Offline
... and it is fixed. The problem was due to a misplaced piece of code in tokenizer.c:
if(feof(fp)) { break; }
Thanks, Barrucadu!
Offline