microlisp 0.1.0
A small Scheme-subset interpreter in modern C.
Loading...
Searching...
No Matches
Enumerations | Functions
eval.c File Reference
#include "microlisp_internal.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for eval.c:

Enumerations

enum  sf_result { SF_NOT_HANDLED = 0 , SF_VALUE , SF_TCO }
 

Functions

static int proper_list_length (mvalue v, size_t *out_len)
 
static microlisp_status eval_arg_list (ml_state *s, mvalue args, mvalue env, mvalue **out_argv, size_t *out_argc)
 
static microlisp_status build_list (ml_state *s, const mvalue *argv, size_t start, size_t end, mvalue *out)
 
static microlisp_status closure_arity (ml_state *s, mvalue params, uint32_t *out_min, int *out_variadic)
 
static microlisp_status make_closure (ml_state *s, mvalue params, mvalue body, mvalue env, mvalue *out)
 
static microlisp_status apply_closure_bind (ml_state *s, mclosure *cl, size_t argc, const mvalue *argv, mvalue *out_env)
 
static microlisp_status handle_quote (ml_state *s, mvalue args, mvalue *out, sf_result *result)
 
static microlisp_status handle_if (ml_state *s, mvalue args, mvalue env, mvalue *new_form, mvalue *new_env, mvalue *out, sf_result *result)
 
static microlisp_status handle_define (ml_state *s, mvalue args, mvalue env, mvalue *out, sf_result *result)
 
static microlisp_status handle_set_bang (ml_state *s, mvalue args, mvalue env, mvalue *out, sf_result *result)
 
static microlisp_status handle_lambda (ml_state *s, mvalue args, mvalue env, mvalue *out, sf_result *result)
 
static microlisp_status begin_tco (ml_state *s, mvalue forms, mvalue env, mvalue *new_form, mvalue *new_env, mvalue *out, sf_result *result)
 
static microlisp_status handle_begin (ml_state *s, mvalue args, mvalue env, mvalue *new_form, mvalue *new_env, mvalue *out, sf_result *result)
 
static microlisp_status handle_let_family (ml_state *s, mvalue args, mvalue env, int starlike, int recursive, mvalue *new_form, mvalue *new_env, mvalue *out, sf_result *result, const char *form_name)
 
static microlisp_status handle_and_or (ml_state *s, mvalue args, mvalue env, int is_or, mvalue *new_form, mvalue *new_env, mvalue *out, sf_result *result)
 
static microlisp_status handle_cond (ml_state *s, mvalue args, mvalue env, mvalue *new_form, mvalue *new_env, mvalue *out, sf_result *result)
 
static microlisp_status eval_body (ml_state *s, mvalue form, mvalue env, mvalue *out)
 
microlisp_status ml_eval (ml_state *s, mvalue form, mvalue env, mvalue *out)
 

Enumeration Type Documentation

◆ sf_result

enum sf_result
Enumerator
SF_NOT_HANDLED 
SF_VALUE 
SF_TCO 

Function Documentation

◆ apply_closure_bind()

static microlisp_status apply_closure_bind ( ml_state s,
mclosure cl,
size_t  argc,
const mvalue argv,
mvalue out_env 
)
static

◆ begin_tco()

static microlisp_status begin_tco ( ml_state s,
mvalue  forms,
mvalue  env,
mvalue new_form,
mvalue new_env,
mvalue out,
sf_result result 
)
static

◆ build_list()

static microlisp_status build_list ( ml_state s,
const mvalue argv,
size_t  start,
size_t  end,
mvalue out 
)
static

◆ closure_arity()

static microlisp_status closure_arity ( ml_state s,
mvalue  params,
uint32_t *  out_min,
int *  out_variadic 
)
static

◆ eval_arg_list()

static microlisp_status eval_arg_list ( ml_state s,
mvalue  args,
mvalue  env,
mvalue **  out_argv,
size_t *  out_argc 
)
static

◆ eval_body()

static microlisp_status eval_body ( ml_state s,
mvalue  form,
mvalue  env,
mvalue out 
)
static

◆ handle_and_or()

static microlisp_status handle_and_or ( ml_state s,
mvalue  args,
mvalue  env,
int  is_or,
mvalue new_form,
mvalue new_env,
mvalue out,
sf_result result 
)
static

◆ handle_begin()

static microlisp_status handle_begin ( ml_state s,
mvalue  args,
mvalue  env,
mvalue new_form,
mvalue new_env,
mvalue out,
sf_result result 
)
static

◆ handle_cond()

static microlisp_status handle_cond ( ml_state s,
mvalue  args,
mvalue  env,
mvalue new_form,
mvalue new_env,
mvalue out,
sf_result result 
)
static

◆ handle_define()

static microlisp_status handle_define ( ml_state s,
mvalue  args,
mvalue  env,
mvalue out,
sf_result result 
)
static

◆ handle_if()

static microlisp_status handle_if ( ml_state s,
mvalue  args,
mvalue  env,
mvalue new_form,
mvalue new_env,
mvalue out,
sf_result result 
)
static

◆ handle_lambda()

static microlisp_status handle_lambda ( ml_state s,
mvalue  args,
mvalue  env,
mvalue out,
sf_result result 
)
static

◆ handle_let_family()

static microlisp_status handle_let_family ( ml_state s,
mvalue  args,
mvalue  env,
int  starlike,
int  recursive,
mvalue new_form,
mvalue new_env,
mvalue out,
sf_result result,
const char *  form_name 
)
static

◆ handle_quote()

static microlisp_status handle_quote ( ml_state s,
mvalue  args,
mvalue out,
sf_result result 
)
static

◆ handle_set_bang()

static microlisp_status handle_set_bang ( ml_state s,
mvalue  args,
mvalue  env,
mvalue out,
sf_result result 
)
static

◆ make_closure()

static microlisp_status make_closure ( ml_state s,
mvalue  params,
mvalue  body,
mvalue  env,
mvalue out 
)
static

◆ ml_eval()

microlisp_status ml_eval ( ml_state s,
mvalue  form,
mvalue  env,
mvalue out 
)

◆ proper_list_length()

static int proper_list_length ( mvalue  v,
size_t *  out_len 
)
static