Skip to content
/ lair Public
forked from qpfiffer/lair

A small Den implementation written in C.

Notifications You must be signed in to change notification settings

MuteLang/lair

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Original picture David Greenwell

Build Status

"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

  • Can print stuff
  • Arguments
  • Functions-as-arguments
  • If statements ('?')
  • Loops (In the form of recursion?)
  • Arrays/Dictionaries
  • Nested Functions

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.

  • Strong, Dynamic types (Erlang style)
  • String internment
  • Persistent data structures
  • Immutability
  • Functions as first-class citizens
  • Low-memory footprint

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

About

A small Den implementation written in C.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 99.2%
  • Makefile 0.8%