x-engine-c v0.2.13
The C engine for x-lang
Loading...
Searching...
No Matches
x-cli.c File Reference

Command-line interface, file inclusion, and interpreter entry point. More...

#include "x-eval.h"
#include "x-heap.h"
#include "x-prim.h"
#include "x-type/buffer.h"
#include "x-type/char.h"
#include "x-type/err.h"
#include "x-type/comment.h"
#include "x-type/int.h"
#include "x-type/list.h"
#include "x-type/operative.h"
#include "x-type/prim.h"
#include "x-type/procedure.h"
#include "x-type/str.h"
#include "x-type/symbol.h"
#include "x-type/whitespace.h"

Macros

#define _GNU_SOURCE
 
#define X_RELEASE   "dev"
 

Functions

x_obj_tinit (x_obj_t *p_base, x_char_t *buffer)
 
int main (int argc, char *argv[])
 

Detailed Description

Command-line interface, file inclusion, and interpreter entry point.

Author
Jon Ruttan (jonru.nosp@m.ttan.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ X_RELEASE

#define X_RELEASE   "dev"

Function Documentation

◆ init()

x_obj_t * init ( x_obj_t p_base,
x_char_t buffer 
)

Initialize the interpreter.

Creates the base object, registers all built-in types and primitives, sets up the read buffer, and optionally binds the syscall and include primitives (when X_SYSCALL / X_INCLUDE are defined).

Parameters
p_basex_obj_t* – Ignored (always creates a fresh base)
bufferx_char_t* – Pre-allocated read buffer
Returns
x_obj_t* – Newly created base object

◆ main()

int main ( int  argc,
char *  argv[] 
)

CLI entry point.

Initializes the interpreter, records the stack base for conservative GC scanning, binds command-line arguments as the x-lang args list, binds x-machine, x-version and x-release platform constants, then enters the REPL.

Parameters
argcint – Argument count
argvchar*[] – Argument vector
Returns
int – Exit status (0 on success, 1 on init failure)