Systems Programming

Math InterpreterC

A lightweight command-line interpreter for evaluating mathematical expressions, storing variables, and executing built-in commands.

View Repository

Language

C

Interface

Command line

Core concept

Expression evaluation

Overview

The goal of this project is to build a mathematical interpreter from scratch in C. Instead of relying on an existing expression evaluator, the interpreter processes user input and evaluates mathematical expressions itself.

The interface is intentionally simple: enter a mathematical expression to evaluate it, assign an expression to a variable to store its value, or use a command to interact with the interpreter.

Capabilities

Features

01

Mathematical Expressions

Evaluate mathematical expressions directly from the command line. Write an expression and get its result.

Example

2 + 3 * (4 - 1)
=>11
02

Variable Storage

Store expression results in named variables and reuse them in subsequent calculations.

Example

VARIABLE_NAME=2 + 3
=>5
03

Built-in Functions

Discover the built-in functions available in the interpreter using a dedicated command.

Example

/btin
=>List built-in functions

Usage

A simple command-line interface

The interpreter accepts mathematical expressions and provides dedicated commands for managing the session.

math-interpreter

$2 + 3 * 4

14

$var={10 + 5}

15

$/vars

Stored variables

var = 15

$/btin

List available built-in functions

$/exit

Exit the interpreter

Illustrative session. The displayed output and variable formatting may differ from the actual implementation.

Reference

Built-in commands

/exit

Exit the interpreter.

/vars

Display the stored variables.

/btin

List the available built-in functions.

Built from scratch in C.

A project focused on parsing, expression evaluation, and building a small interpreter without relying on an existing math engine.

Explore the source