~qpfiffer/lair

Bizarro minimalist language.
Don't need to check here, just use throw_exception.
Add disparate equality test.
More useful tests

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~qpfiffer/lair
read/write
git@git.sr.ht:~qpfiffer/lair

You can also use your local clone with git send-email.

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

  • [x] Can print stuff
  • [x] Arguments
  • [x] Functions-as-arguments
  • [x] If statements ('?')
  • [x] Loops (In the form of recursion?)
  • [x] Throwable Exceptions
  • [ ] Catchable Exceptions
  • [ ] 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