Skip to content

a slim almost-lisp-like embedded scripting language

License

Notifications You must be signed in to change notification settings

AMBandariM/nah.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nah.h

nah is a slim almost-lisp-like scripting language. it's primary goal is to be used as an embedded language (nahofte in Persian means embedded): it's a single-header-only stb-style library written in C89, it just depends on some standard libraries and dosn't use malloc.

Quick Start

just copy-paste nah.h into your project and use it like this:

#define NAH_IMPLEMENTATION
#include "nah.h"

int main(void) {
    NahValue value = nah_eval_string("(+ 1 2 3 4)");
    nah_print_value(value);
    return 0;
}

More

you can introduce C functions and macros (not implemented yet!) to extend the language, see nah.c for example. see INTERFACE section of nah.h for more functionalities.

Language

nah's language is like lisp, but without lambda functions: first expresion of a list has to be a symbol! additionally, nah's language has a synatx sugar for (do ...). it's like this:

(do (a b c d) (x y z) (u v w)) 
==
{ a b c d; x y z; (u v w)}

or, if you don't care about reslut of (u v w) it can be like { a b c d; x y z; u v w; }. for example this is a valid script:

{
    var a 0;
    var b 1;
    var c;
    while (< a 1000) {
        set c (+ a b);
        set a b;
        set b c;
    };
    a
}

License

it's under public domain licnese and mit lincense, which ever you prefer. see end of nah.h for complete information.

About

a slim almost-lisp-like embedded scripting language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published