Skip to content

Commit

Permalink
feat: add initial documentation (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
xXenvy authored Jul 27, 2024
1 parent cfb8e0d commit b117a28
Show file tree
Hide file tree
Showing 11 changed files with 362 additions and 37 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Documentation

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Build Docs site
run: python3 build_docs.py

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.ZYNK_DOCS }}
publish_dir: ./site
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CMakePresets.json
out/
out/
venv/
46 changes: 10 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="https://github.com/xXenvy/Zynk/assets/111158232/2f92acf0-409e-4e6d-b80f-2379b01d31f7" width="200" height="200">

# Zynk - Touring-complete, interpreted programming language
# Zynk - Turing-complete, interpreted programming language

![commits](https://img.shields.io/github/commit-activity/w/xXenvy/Zynk?style=for-the-badge&color=%2315b328)
![license](https://img.shields.io/github/license/xXenvy/Zynk?style=for-the-badge&color=%2315b328)
Expand All @@ -12,47 +12,21 @@
<!--- ![release](https://img.shields.io/github/v/release/xXenvy/Zynk?include_prereleases&style=for-the-badge&color=%2315b328) -->

## `📃` Introduction
Zynk is a Touring-complete, interpreted programming language written in C++. This project was created as a personal endeavor to learn and practice C++. It is not intended for extensive practical use but rather serves as a learning platform.
Zynk is a Turing-complete, interpreted programming language written in C++. This project was created as a personal endeavor to learn and practice C++. It is not intended for extensive practical use but rather serves as a learning platform.

## `🌟` Features
- **Interpreted Language:** Zynk is an interpreted language, which facilitates quick development and testing cycles.
- **Touring-Complete:** Zynk is capable of expressing any computable function, adhering to the touring-complete classification.
- **C++ Backend:** Written in C++, Zynk leverages the performance and capabilities of C++ while providing a user-friendly interface.

## `🔨` Installation
### 1. Download Precompiled Interpreter (Recommended)
1. Go to the [Releases](https://github.com/xXenvy/Zynk/releases) page.
2. Download the latest release package for your operating system.
3. Extract the package to your desired location.
## `📖` Documentation

### 2. Build from Source
1. Clone the repository:
```shell
git clone https://github.com/xXenvy/Zynk.git
```
Comprehensive documentation for Zynk is available on our [**Documentation Website**](https://xxenvy.github.io/Zynk/). The documentation includes:

2. Navigate to the project directory:
```shell
cd Zynk
```

3. Create a directory for temporary files (commonly named `build`):
```shell
mkdir build
cd build
```

4. Configure CMake and build the project.
> Command to build project depends on your system.
```shell
cmake ..
cmake --build . --config Release
```

5. Once the compilation is complete, you can run the Zynk interpreter from the `src` directory:
```shell
./Zynk
```
- **[Installation Guide](https://xxenvy.github.io/Zynk/installation/):** Detailed instructions for installing Zynk.
- **[Hello World Tutorial](https://xxenvy.github.io/Zynk/examples/hello_world/):** A step-by-step guide to writing your first Zynk program.
- **[Basic Examples](https://xxenvy.github.io/Zynk/examples/basics/):** Simple code examples to get you started.
- **[Data Types](https://xxenvy.github.io/Zynk/data-types/):** Overview of primitive data types in Zynk.

## `🚀` Road to 1.0
> Keep in mind that **Zynk** is a very young project!
Expand All @@ -63,6 +37,6 @@ As Zynk progresses towards version 1.0, the following components are planned and
- [x] **Evaluator:** Creating an evaluator to interpret and execute code represented by the AST.
- [x] **Runtime:** Implementing a runtime environment responsible for managing execution contexts, memory allocation, and variable scope resolution during program execution.
- [x] **GC:** Implementing a Garbage Collection (GC) system to automatically manage memory, reclaim unused memory.
- [ ] **Documentation:** Developing thorough documentation that covers usage instructions, language syntax and examples.
- [x] **Documentation:** Developing thorough documentation that covers usage instructions, language syntax and examples.
- [ ] **Turing-Complete Features:** Enhancing language features to fully meet the Turing-complete classification, ensuring that Zynk can simulate any Turing machine.
- [ ] **Visual Studio Code Plugin:** Creating a plugin for Visual Studio Code to enhance the development experience for Zynk.

32 changes: 32 additions & 0 deletions build_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import subprocess
import sys

def install_dependencies():
"""Install MkDocs and the necessary plugins."""
try:
# Check if MkDocs is installed
subprocess.run([sys.executable, "-m", "pip", "install", "mkdocs"], check=True)
subprocess.run([sys.executable, "-m", "pip", "install", "mkdocs-material"], check=True)
print("Successfully installed MkDocs and MkDocs Material.")
except subprocess.CalledProcessError as e:
print("Error installing dependencies:", e)
sys.exit(1)

def build_docs():
"""Build the documentation using MkDocs."""
try:
subprocess.run(["mkdocs", "build"], check=True)
print("Documentation built successfully.")
except subprocess.CalledProcessError as e:
print("Error building documentation:", e)
sys.exit(1)

def main():
print("Starting the documentation build process...")
install_dependencies()
build_docs()
print("Documentation build process completed.")

if __name__ == "__main__":
main()
45 changes: 45 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing

Contributions to Zynk are highly welcome and greatly appreciated! Whether you are a seasoned developer or a newcomer, your input can help improve the project and make it better for everyone.

### How to Contribute

Here are a few simple steps to get involved:

1. **Fork the Repository:**
Create a fork of the Zynk repository to make your changes. This allows you to work on your copy of the project and propose improvements or fixes.

2. **Develop Your Changes:**
Work on your feature or bug fix in your forked repository. Make sure to write clear, concise code and provide helpful comments where necessary.

3. **Create a Pull Request:**
Once you're satisfied with your changes, create a pull request (PR) to the main Zynk repository. Provide a detailed description of your changes and the motivation behind them.

4. **Collaborate and Iterate:**
Engage with the community by responding to feedback on your pull request. We encourage open discussion and value every contribution, big or small.

### Contribution Ideas

Here are a few ways you can contribute to Zynk:

- **Bug Reports:**
If you encounter any issues or bugs while using Zynk, please report them through our [Issue Tracker](https://github.com/xXenvy/Zynk/issues). Detailed bug reports help us identify and fix problems quickly.

- **Feature Requests:**
If you have ideas for new features or improvements, share them with the community through our [Feature Request](https://github.com/xXenvy/Zynk/issues) section. We are always open to innovative suggestions.

- **Documentation Enhancements:**
Clear and concise documentation is crucial for any project. You can help improve the Zynk documentation by fixing typos, adding examples, or clarifying explanations.

- **Code Improvements:**
Review the existing codebase and suggest optimizations or refactorings. Clean, efficient code is vital for the long-term success of the project.

- **Test Cases:**
Writing test cases is essential for ensuring code stability and functionality. You can contribute by adding new tests or improving existing ones.

### Getting Help

If you need assistance or have questions about contributing, feel free to reach out to the Zynk community:

- **Discussion Forum:**
Join [Discussion Forum](https://github.com/xXenvy/Zynk/discussions) to ask questions, and share ideas.
12 changes: 12 additions & 0 deletions docs/data-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Data types

Zynk currently supports only primitive data types, which are fundamental for basic computations and operations. Understanding these types is essential for writing efficient and correct programs. This section will cover the basic data types available in Zynk.

## Primitive Data Types

Zynk offers several primitive data types:

- **Integer (`int`)**: Represents whole numbers without decimals.
- **Float (`float`)**: Represents numbers with decimals.
- **Bool (`bool`)**: Represents truth values, true or false (1 and 0).
- **String (`String`)**: Represents sequences of characters.
49 changes: 49 additions & 0 deletions docs/examples/basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Basic Examples

Welcome to the Basic Examples section. Here, we showcase fundamental code snippets to help you get started with Zynk.

## Example 1: Basic Variables and Output

This example demonstrates the use of variables and basic output functions.

def main() {
var x: int = 1;
var y: String = "elo";
println(x);
println(y);
}
main();

## Example 2: Control Flow with Loops and Conditionals

This example shows how to use loops and conditionals in Zynk.

def main() {
var x: int = 1;

while(true) {
if(x == 1) {
break;
}
}
}
main();

## Example 3: Nested Functions

This example demonstrates defining and calling functions, including nested functions.

def main() {
var number: int = 1;

def displayNumber() {
println(number);
var multiplier: float = 1.5;
def calculateAndPrint() {
println(number * multiplier);
}
calculateAndPrint();
}
displayNumber();
}
main();
60 changes: 60 additions & 0 deletions docs/examples/hello_world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Write your first program

Welcome to the "Hello, World!" tutorial for Zynk. In this guide, we'll create a simple Zynk program that prints "Hello, World!" to the console. Follow the steps below to get started.

## 1. Create a new Zynk file

First, you'll need to create a new file with a `.zk` extension. This file will contain your Zynk code.

1. Open your favorite text editor or IDE.
2. Create a new file and save it as `hello.zk`.

## 2. Write your Zynk program

In the `hello.zk` file, write the following Zynk code:

println("Hello, World!");

### Explanation

- `println("Hello, World!");`: This line of code calls the `println` function, which outputs the string `"Hello, World!"` to the console followed by a newline character.

## 3. Run your Zynk program

To run your Zynk program, follow these steps:

1. **Open a Terminal or Command Prompt.**
2. **Navigate to the directory containing your `hello.zk` file. For example:**

```
cd path/to/your/directory
```

3. **Execute the Zynk interpreter with your file as an argument:**

```
./Zynk hello.zk
```

### Expected Output

When you run the program, you should see the following output:

Hello, World!

## 4. Troubleshooting

If you encounter any issues, make sure of the following:

- The Zynk interpreter is correctly installed and located in your system's PATH.
- The file extension is `.zk` and the code is properly written.
- You are running the command from the directory where `hello.zk` is located.

## Next Steps

Congratulations on writing your first Zynk program! Here are some suggestions for what to do next:

- Explore more Zynk functions and syntax by referring to the [Language Reference](#) section of the documentation.
- Experiment with more complex programs and learn about variables, loops, and functions in Zynk.

Happy coding!
37 changes: 37 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Welcome

This is the official documentation for Zynk, a language designed primarily for educational purposes and exploration. Zynk is not intended for production use but serves as an interesting platform for learning and experimenting with C++.

## 🌟 Features

- **Interpreted Language:** Zynk is an interpreted language, designed to speed up development and testing cycles. With its interactive environment, you can quickly prototype and debug your code without the need for lengthy compile times.

- **Turing-Complete:** Zynk adheres to the Turing-complete classification, meaning it can express any computable function. This makes Zynk a versatile tool for solving a wide range of problems, from simple scripts to complex algorithms.

- **C++ Backend:** Written in C++, Zynk combines the high performance and efficiency of C++ with a user-friendly interface. This hybrid approach ensures that your applications run swiftly while remaining easy to develop and maintain.

## 🚀 Getting Started

To get started with Zynk, follow these steps:

1. **Installation**: Download and install the latest version of Zynk from [Installation Guide](installation.md).
2. **Hello World**: Write your first Zynk program with [Hello World Tutorial](examples/hello_world.md).

## 🔍 Language Reference

Dive into the specifics of Zynk’s syntax and semantics:

- **Basic Syntax**: Learn the fundamental rules and conventions of Zynk syntax in [Basic Examples](examples/basics.md).
- **Data Types**: Explore the different data types available in Zynk and how to use them effectively in [Data Types](data-types.md).

## 🤝 Contributing

Contributions to Zynk are welcome. Learn how to contribute on [Contribution Guidelines](contributing.md).

## 🛠️ Support

For support and troubleshooting, please refer to the following resources:

- **Issues:** Report bugs, request features, or track existing issues on [GitHub Issues Page](https://github.com/xXenvy/Zynk/issues).
- **Discussions:** Engage with the community, ask questions, and share ideas on [GitHub Discussions Page](https://github.com/xXenvy/Zynk/discussions).

Loading

0 comments on commit b117a28

Please sign in to comment.