Language of Vectors Project: VectorLang VectorLang is a simple programming language designed to operate on vectors (one-dimensional arrays). It provides basic vector manipulation functions such as vector addition, scalar multiplication, dot products, and other common operations. This language also includes a custom syntax and supports basic type checking, error handling, and interpretation.
This project is part of a coursework assignment where we implement key concepts of language design and development, including lexical analysis, parsing, type checking, and interpretation.
Table of Contents Problem Definition Key Features Language Overview Implementation Grammar Specification Lexical Analysis Parsing Type Checking Error Reporting Interpretation Compilation Usage Contributions License Problem Definition In this project, we aim to design and implement a small language called VectorLang to manipulate one-dimensional arrays (vectors) efficiently. The language should support:
Vector Addition Scalar Multiplication Dot Product (Scalar Product) Vector Comparison Other vector-related operations The language will provide simple syntax to express these operations and will be compiled or interpreted in a basic algorithmic language.
The project should include:
Lexical Analysis: Tokenize the input source code into meaningful elements. Parsing: Define and enforce a grammar for the language to ensure correct syntax. Type Checking: Ensure vectors are compatible for operations and raise errors when they are not. Error Reporting: Clear and informative error messages. Interpretation: The ability to interpret and run code written in VectorLang. Key Features Vector Operations: Add, subtract, scalar multiply, and dot product. Type Checking: Ensure that operations are only performed on valid vectors. Error Handling: Detect and report errors in syntax or type mismatches. Interpretation: A simple interpreter for running VectorLang code. Extendable: Additional vector operations can be easily added to the language.