bfx
An interpreter, compiler, and REPL for brainfuck-like languages
Loading...
Searching...
No Matches
pbrain.h File Reference
#include "bfx.h"

Go to the source code of this file.

Data Structures

struct  BFX_PBrainProcedure
 Structure to represent a procedure in the pbrain language. More...
 
struct  BFX_PBrainData
 Structure to represent data for the pbrain language. More...
 

Macros

#define BFX_PBRAIN_MAX_PROCEDURES   256
 Maximum number of procedures allowed in the P-Brain language.
 
#define BFX_PBRAIN_STACK_SIZE   16
 

Functions

BFX_Error bfx_pbrain_init (BFX *)
 Initialize the P-Brain interpreter.
 
BFX_Error bfx_pbrain_run (BFX *)
 Run the P-Brain interpreter.
 
BFX_Error bfx_op_pbrain_start_procedure (BFX *, BFX_FileIndex *)
 Begin procedure definition (pbrain).
 
BFX_Error bfx_op_pbrain_call (BFX *, BFX_FileIndex *)
 Call a procedure by its identifier (pbrain).
 
BFX_Error bfx_op_pbrain_ret (BFX *, BFX_FileIndex *)
 Return from a procedure (pbrain).
 

Detailed Description

This file contains public definitions for the implementation of the P-Brain interpreter.

Macro Definition Documentation

◆ BFX_PBRAIN_MAX_PROCEDURES

#define BFX_PBRAIN_MAX_PROCEDURES   256

Maximum number of procedures allowed in the P-Brain language.

This limit is set to the maximum possible value since procedures are designated by 8-bit identifiers.

◆ BFX_PBRAIN_STACK_SIZE

#define BFX_PBRAIN_STACK_SIZE   16

Function Documentation

◆ bfx_op_pbrain_call()

BFX_Error bfx_op_pbrain_call ( BFX bfx,
BFX_FileIndex index 
)

Call a procedure by its identifier (pbrain).

◆ bfx_op_pbrain_ret()

BFX_Error bfx_op_pbrain_ret ( BFX bfx,
BFX_FileIndex index 
)

Return from a procedure (pbrain).

◆ bfx_op_pbrain_start_procedure()

BFX_Error bfx_op_pbrain_start_procedure ( BFX bfx,
BFX_FileIndex idx 
)

Begin procedure definition (pbrain).

Parameters
bfPointer to the interpreter struct
idxPointer to the file index struct

◆ bfx_pbrain_init()

BFX_Error bfx_pbrain_init ( BFX bfx)

Initialize the P-Brain interpreter.

Parameters
bfxPointer to the already-allocated interpreter struct

◆ bfx_pbrain_run()

BFX_Error bfx_pbrain_run ( BFX bfx)

Run the P-Brain interpreter.

This function initializes and runs the P-Brain interpreter. It frees all language-specific data.

Parameters
bfxPointer to the interpreter struct