https://github.com/antomfdez/bitcraft
BitCraft is a simple programming language designed for performing basic mathematical operations and printing results.
https://github.com/antomfdez/bitcraft
Last synced: 10 months ago
JSON representation
BitCraft is a simple programming language designed for performing basic mathematical operations and printing results.
- Host: GitHub
- URL: https://github.com/antomfdez/bitcraft
- Owner: antomfdez
- Created: 2024-07-23T20:16:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-23T20:23:57.000Z (almost 2 years ago)
- Last Synced: 2025-02-28T09:10:37.159Z (over 1 year ago)
- Language: C++
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BitCraft
BitCraft is a simple programming language designed for performing basic mathematical operations and printing results. It supports variable assignments, arithmetic expressions, and custom print formatting.
## Features
- **Variable Assignment**: Assign values to variables.
- **Arithmetic Operations**: Perform addition, subtraction, multiplication, and division.
- **Printing**: Print variables and expressions with customizable formatting.
- **Comments**: Add comments to your source code for clarity.
## Syntax
### Variables and Assignments
Variables can be assigned using the `=` operator. For example:
```plaintext
width = 5;
height = 10;
```
### Arithmetic Expressions
Arithmetic expressions are supported using +, -, *, and / operators. For example:
```
area = width * height;
```
### Printing
Use the print statement to output text and variables. The print statement accepts multiple arguments, including strings and variables, separated by commas. For example:
```
print("The width is ", width, " and the height is ", height, " The area is ", area, ".");
```
### Comments
Single-line comments are supported and start with //. For example:
```
// This is a comment
width = 5;
```
### Parentheses
Parentheses () are used to group expressions. For example:
```
result = (width + height) * 2;
```
## Full example
Here’s a complete example of a source file using BitCraft:
```
// Define variables
width = 5.53;
height = 10.4;
// Calculate area
area = width * height;
// Print results
print("The width is ", width, " and the height is ", height);
print("The area is ", area);
```
## Usage
1 - Create a Source File: Write your BitCraft code in a text file with a .bc extension (e.g., program.bc).
2 - Compile and Run: Use the provided Makefile to compile and execute your interpreter. For example:
```
bitc program.bc
```
## Build:
```
sudo make
```
# License
This project is licensed under the [MIT](https://choosealicense.com/licenses/mit/) License. See the LICENSE file for more details.
# Contributing
Contributions are welcome! Please submit issues and pull requests via the GitHub repository.