PitchHut logo
Arc
A simple, C-based programming language with a clean interpreter.
Pitch

Arc is a lightweight programming language crafted in C, designed for simplicity and ease of use. With features like variable assignments, functions, and control flow statements, it provides a clear structure for both beginners and experienced developers. Explore its straightforward REPL for interactive coding or use it for file execution.

Description

Arc is an innovative programming language project meticulously crafted with C, designed for simplicity and reliability. Its primary focus is on establishing a streamlined frontend pipeline paired with an intuitive interpreter capable of evaluating expressions and facilitating basic variable assignments.

Key Features

Arc provides a robust set of features tailored for both novice and experienced programmers:

  • Variables and Assignment: Easily declare and update variables using the VAR keyword.
  • Functions: Implement custom functions complete with parameters and return values through the FN and RETURN keywords.
  • Native Functions: Access built-in functions executed in C, enabling essential functionalities like input/output operations, type checking, and error management.
  • Control Flow:
    • Utilize Conditional Statements such as IF, THEN, ELIF, and ELSE for logic branching.
    • Employ WHILE loops for the repetition of code segments, along with control flow statements like BREAK and CONTINUE for granular loop control.
  • Operators: Comprehensive support for a range of arithmetic (+, -, *, /, ^), comparison (==, !=, <, >, <=, >=), and logical (AND, OR) operations.
  • Data Types: Manage various data types including numbers, strings, and booleans.
  • Error Handling: Benefit from sophisticated error reporting, complete with position tracking to facilitate debugging.
  • Read-Eval-Print Loop (REPL): Engage in an interactive environment for immediate execution of Arc code.

Example Usage

Consider the following example demonstrating file execution in Arc. Create a file named script.arc:

VAR x = 0

WHILE x < 5 THEN
    VAR x = x + 1
END

IF x == 5 THEN
    print("Five")
ELSE
    print("Not Five")
END

Executing this file with ./arc script.arc will produce:

Five

Roadmap

Future enhancements to Arc aim to include:

  • Implementation of a logical NOT operator
  • Introduction of scoped environments
  • Development of a bytecode virtual machine as a long-term goal

For extensive documentation including getting started guides, language reference, and architecture details, refer to the contents in the docs/ folder.

0 comments

No comments yet.

Sign in to be the first to comment.