Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/emdash/goof

A toy functional language created through the abuse of C
https://github.com/emdash/goof

Last synced: about 1 month ago
JSON representation

A toy functional language created through the abuse of C

Awesome Lists containing this project

README

        

Copyright (C) 2010 Brandon Lewis

Introduction

Goof is an experimental functional language with a novel implementation. It is
a library of functions and macros which combine to create the illusion that
you are writing in a high-level language. Despite this, goof programs are C
programs. They are compiled and executed like any other.

Don't be fooled into thinking it's efficient: Goof is essentially a dynamic
language, with the runtime implemented directly in C.

Goof programs are expressed as nested calls to functions and macros. Each
function returns a pointer to an object which implements a language contruct.

Known Downsides (or, "Why in God's name are you doing this?")

- I just wrote it over the weekend for fun
- No memory management at present
- Dynamic implementation is probably inefficient
- I am largely ignorant of how concurrency might affect this system
- Possibly difficult to debug, and syntax erros are difficult to resolve due
to the heavy abuse of preprocessor macros.

Potential Upsides

Though I acknowledge that this is really a pretty terrible thing to do to an
unsuspecting C programmer, I feel that there might be certain useful features
of this approach that are worth exploring. In addition to the well-known
advantages of functional programming, goof might offer the following:

- educational value
- small implementation
- easy to add new constructs to the language
- easy to inter-operate between C and goof
- requires nothing other than a C compiler (after removing the glib code)
- you potentially mix and match different semantics within the same executable
(e.g. applicative versus normal order, eager versus strict, allow
non-deterministic evaluation etc).

Liscence

Goof is available under LGPL v3