maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
MLISP Interpreter
Collaboration diagram for MLISP Interpreter:

Topics

 MLISP Execution Stack
 
 MLISP Types
 
 MLISP Abstract Syntax Tree Parser
 

Files

file  mlispe.h
 MLISP Interpreter Functions and Macros.
 
file  mlisps.h
 MLISP Interpreter/Parser Structs.
 
file  mlispp.h
 MLISP Parser Functions and Macros.
 

Data Structures

union  MLISP_VAL
 
struct  MLISP_ENV_NODE
 
struct  MLISP_STACK_NODE
 
struct  MLISP_AST_NODE
 
struct  MLISP_EXEC_STATE
 
struct  MLISP_PARSER
 

Macros

#define MLISP_TOKEN_SZ_MAX   4096
 
#define MLISP_EXEC_TRACE_LVL   0
 
#define MLISP_ENV_FLAG_BUILTIN   0x02
 
#define MLISP_ENV_FLAG_CMP_GT   0x10
 Flag for _mlisp_env_cb_cmp() specifying TRUE if A > B.
 
#define MLISP_ENV_FLAG_CMP_LT   0x20
 Flag for _mlisp_env_cb_cmp() specifying TRUE if A < B.
 
#define MLISP_ENV_FLAG_CMP_EQ   0x40
 Flag for _mlisp_env_cb_cmp() specifying TRUE if A == B.
 
#define MLISP_ENV_FLAG_ARI_ADD   0x10
 Flag for _mlisp_env_cb_arithmetic() specifying to add A + B.
 
#define MLISP_ENV_FLAG_ARI_MUL   0x20
 Flag for _mlisp_env_cb_arithmetic() specifying to multiply A * B.
 
#define MLISP_ENV_FLAG_ARI_DIV   0x40
 
#define MLISP_ENV_FLAG_ARI_MOD   0x80
 
#define MLISP_ENV_FLAG_ANO_OR   0x10
 
#define MLISP_ENV_FLAG_ANO_AND   0x20
 
#define _MLISP_TYPE_TABLE_PUSH_PROTO(idx, ctype, name, const_name, fmt)
 
#define MLISP_TRACE_LVL   0
 
#define MLISP_TRACE_SIGIL   "TRACE"
 
#define MLISP_AST_IDX_CHILDREN_MAX   10
 
#define MLISP_EXEC_FLAG_DEF_TERM   0x02
 Flag for MLISP_EXEC_STATE::flags indicating next token is a term to be defined.
 
#define _MLISP_TYPE_TABLE_FIELDS(idx, ctype, name, const_name, fmt)
 
#define MLISP_PARSE_TRACE_LVL   0
 
#define MLISP_AST_FLAG_LAMBDA   0x02
 
#define MLISP_AST_FLAG_IF   0x04
 
#define MLISP_AST_FLAG_DEFINE   0x08
 
#define MLISP_AST_FLAG_BEGIN   0x20
 
#define MLISP_PARSER_PSTATE_TABLE(f)
 

Typedefs

typedef MERROR_RETVAL(* mlisp_env_cb_t) (struct MLISP_PARSER *parser, struct MLISP_EXEC_STATE *exec, size_t n_idx, size_t args_c, void *cb_data, uint8_t flags)
 

Functions

struct MLISP_ENV_NODEmlisp_env_get_strpool (struct MLISP_PARSER *parser, struct MLISP_EXEC_STATE *exec, const char *strpool, size_t token_strpool_idx, size_t token_strpool_sz)
 Get a node from the environment denoted by a string in the strpool.
 
MERROR_RETVAL mlisp_env_unset (struct MLISP_PARSER *parser, struct MLISP_EXEC_STATE *exec, const char *token, size_t token_sz)
 
MERROR_RETVAL mlisp_env_set (struct MLISP_PARSER *parser, struct MLISP_EXEC_STATE *exec, const char *token, size_t token_sz, uint8_t env_type, const void *data, void *cb_data, uint8_t flags)
 
MERROR_RETVAL mlisp_step (struct MLISP_PARSER *parser, struct MLISP_EXEC_STATE *exec)
 
MERROR_RETVAL mlisp_parse_c (struct MLISP_PARSER *parser, char c)
 
MERROR_RETVAL mlisp_parser_init (struct MLISP_PARSER *parser)
 
MERROR_RETVAL mlisp_exec_init (struct MLISP_PARSER *parser, struct MLISP_EXEC_STATE *exec)
 
void mlisp_parser_free (struct MLISP_PARSER *parser)
 

Detailed Description

Macro Definition Documentation

◆ _MLISP_TYPE_TABLE_FIELDS

#define _MLISP_TYPE_TABLE_FIELDS ( idx,
ctype,
name,
const_name,
fmt )
Value:
ctype name;

◆ _MLISP_TYPE_TABLE_PUSH_PROTO

#define _MLISP_TYPE_TABLE_PUSH_PROTO ( idx,
ctype,
name,
const_name,
fmt )
Value:
MERROR_RETVAL _mlisp_stack_push_ ## ctype( \
struct MLISP_EXEC_STATE* exec, ctype i );
int MERROR_RETVAL
Return type indicating function returns a value from this list.
Definition merror.h:19
Definition mlisps.h:109

◆ MLISP_PARSER_PSTATE_TABLE

#define MLISP_PARSER_PSTATE_TABLE ( f)
Value:
f( MLISP_PSTATE_NONE, 0 ) \
f( MLISP_PSTATE_SYMBOL_OP, 1 ) \
f( MLISP_PSTATE_SYMBOL, 2 ) \
f( MLISP_PSTATE_STRING, 3 ) \
f( MLISP_PSTATE_LAMBDA_ARGS, 4 ) \
f( MLISP_PSTATE_COMMENT, 5 )

Function Documentation

◆ mlisp_env_get_strpool()

struct MLISP_ENV_NODE * mlisp_env_get_strpool ( struct MLISP_PARSER * parser,
struct MLISP_EXEC_STATE * exec,
const char * strpool,
size_t token_strpool_idx,
size_t token_strpool_sz )

Get a node from the environment denoted by a string in the strpool.

Parameters
parser
token_strpool_idxIndex of the env key in the strpool.
token_strpool_szLength of the env key in the strpool. Use 0 to detect automatically by NULL termination.
Returns
Pointer to e in MLISP_PARSER::env. This is not a copy, so the pointer is only valid for so long as MLISP_PARSER:env remains locked!