Skip to content

Wazzaps/dynami_c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dynami_c

a simple & lightweight interpreter

Example files

$1="I said \"Hello\" and val is 0x%x\n"
$2=0x1234
printf

Output:

I said "Hello" and val is 0x1234

A c program to run this program:

#include <stdio.h>
#include "dynamic.h"

struct symbol symbols[] = {
    { "printf", &printf },
    { }
};

int main() {
    // Make sure this is mutable! (p.s. it will be destroyed after the run)
    char program[] = "$1=\"I said \\\"Hello\\\" and val is 0x%x\\n\"\n"
                     "$2=0x1234\n"
                     "printf";
    if (dynamic_eval(program, symbols) != 0) {
        printf("dynami_c failed to parse the program\n");
        return -1;
    }
    return 0;
}

About

a simple & lightweight interpreter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published