Skip to content
/ eight Public

Eight is a toy programming language built for metaprogramming.

Notifications You must be signed in to change notification settings

diiq/eight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

                                 .ooooo.          
                                d88'   `8. 
                                Y88..  .8' 
                                 `88888b.  
                                .8'  ``88b 
                                `8.   .88P 
                                 `boood8'  



Document last modified: 2/2/2010                                      
Eight 2010, a lisp by Sam Bleckley

Contact me!
Sam Bleckley
http://sambleckley.com/
[email protected]


    Gnawing on bones
    My tongue is sore from trying to get the marrow out
    I refuse to ignore the meat any longer

I intend to sculpt Eight into a beautiful and emotional and
extraordinarily powerful programming language. I am not concerned with
speed of execution or ease of learning. Programmers want to be magic
ninjas. Eight lets programmers do magic ninja things.


-------------------------------------------------------------------------------
                             A Quick-Start Guide

I am still actively altering and developing Eight. If you seek a
finished, capable language, you will not find one here. However, if
you're looking to help build a language to be beautiful inside and
out, Eight may be for you.

Follow along with these examples at http://diiq.org/eight, or by
cloning the repository and using the python implementation:

$ python/8 test.8 

I built Eight for metaprogramming. In my opinion, no other language
equals Eight in the power and simplicity of its fexprs. To understand
why, take a look at a function definition in Eight:

    (def with ('sym val ... 'body)
         ((fn ,(list sym) *body) val))

(I'll assume you've got a working knowledge of lisp --- it doesn't
matter which one. Arc, scheme, common --- it's all the same to me.)

Questions to ask about this function:

What does this function do?  Much like with in Arc or let in common
lisp, this function temporarily binds a value to a variable; it might
be used like this:

(with a (+ 2 3) (print a) (* a 2))

Which would print "5" and return 10. Afterwards, a will be unbound (or
return to the binding it had previously in this scope).

How does def work?

def takes three arguments: a symbol: with; a lambda list: ('sym val
... 'body); and a body of expressions: ((fn ,(list sym) *body) val).

What does the ... mean?

The elipsis works just like &rest in common list, or a . in Arc or
scheme: body will be bound to a list of all remaining arguments.

Why are arguments in the lambda list quoted?

In Eight, argument names in the lambda list can have a function
applied to them; this is clearer if I desugar the lambda list:

    ((' sym) val ... (' body))

' is a function. Before the arguments are evaluated, that function is
applied; ' prevents the evaluation of those arguments. It also does
more, but that's much is important to understand first: the argument
bound to sym will not be evaluated; the argument(s) to body will not
be evaluated. They will be passed to ', and the result will be bound.

,? *? What do they do?

, prevents an argument from being wrapped in a function, when the
lambda-list calls for it. fn quotes its first argument, but with has
*already* quoted that argument. Usually, , acts as a sort of opposite
to '.

* unpacks a list into arguments:

    (list *(a b c)) 

is the same as:

    (list a b c)

THe behavior of *, @, and , are still in flux. I am unhappy with the
false symmetry of , and ', and * currently hides an extra eval which
could be dangerous.


For a more in-depth look at what Eight is, take a look at
python/eight.py . It is a well-documented and reasonably organized
implementation.

About

Eight is a toy programming language built for metaprogramming.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published