qpfiffer / lair

A small Den implementation written in C.
MIT License
19 stars 5 forks source link

Original picture David Greenwell

"It is a dark world where all you have are functions, and all you can do is apply them to each other." - Anonymous

Done status

This is an experimental Den implementation. It intends to support all of the same syntax with some extra goodies.

Goals

This is the first language I've ever written an interpreter for, so it is as much a learning process as anything else.

Installation

  1. make
  2. Thats it. You should now have a lair binary.

Debugging

Edit the Makefile to turn on the DEBUG flag, then rebuild:

    CFLAGS=-Werror -Wextra -Wall -g3 -Wno-missing-field-initializers -DDEBUG
    make clean
    make

Now you'll get extra fancy, obtuse output:

$ ./lair t/functions_all_the_way_down.den 
FUNCTION a FUNCTION_ARG {
    RETURN CALL ATOM ATOM 
}
FUNCTION b FUNCTION_ARG 
    RETURN CALL ATOM ATOM 
}
FUNCTION c FUNCTION_ARG 
    RETURN CALL ATOM 
}
FUNCTION d 
    RETURN STRING 
}
CALL ATOM CALL ATOM ATOM EOF 
---
This is the real test.

Usage

Currently there is no REPL for testing, so for now usage is limited to loading a file, parsing it, executing it and then doing whatever the program wanted via STDOUT/STDIN.

./lair t/basic.den

Documentation

Documentation is done with Doxygen. Note that this is for Lair itself, not for Den.

To build docs:

doxygen lair.conf