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.
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
VARkeyword. - Functions: Implement custom functions complete with parameters and return values through the
FNandRETURNkeywords. - 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, andELSEfor logic branching. - Employ
WHILEloops for the repetition of code segments, along with control flow statements likeBREAKandCONTINUEfor granular loop control.
- Utilize Conditional Statements such as
- 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
NOToperator - 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.
No comments yet.
Sign in to be the first to comment.