Skip to content

HelloItsJustin/Juslyn-Programming-Language

Repository files navigation

🌟 Juslyn Programming Language

Juslyn is a lightweight, experimental programming language built entirely from scratch in Python. It is designed to be simple, expressive, and educational, showing how programming languages are made while also being fun to use for small projects.

Unlike mainstream languages, Juslyn introduces its own unique keywords and syntax, making programs easy to read and visually distinct.


🚀 Why Juslyn?

Juslyn was created to explore:

  • 🏗️ How interpreters work – from parsing to execution.
  • Readable syntax – keywords that feel natural and minimal.
  • 🎓 Educational design – great for learning programming concepts without boilerplate.
  • 🧪 Experimentation – a sandbox to play with recursion, loops, math, and lists.

It’s not built to replace mainstream languages, but to teach, inspire, and experiment.


✨ Key Features

  • 🗃️ Variables → store values with POCKET
  • Math expressions → supports + - * / ~ (power)
  • 🔗 String concatenation"Hello " + name
  • 🔀 Conditionals → clean branching with CHECK, OTHERWISE, FINISH
  • 🔁 Loops → controlled iteration with REPEAT ... TO ... STEP
  • 🧑‍💻 Functions → define reusable logic with TASK ... SEND
  • 🔂 Recursion → supports calling functions within themselves
  • 📋 Lists → create, append, and measure length
  • 🖨️ Printing → output values with PRINT
  • 📂 Script runner → execute external .juslyn files with RUN("file.juslyn")

🛠️ Getting Started with Juslyn

If you want to try Juslyn yourself, follow these steps:

1. Clone the Repository

git clone https://github.com/yourusername/Juslyn-Programming-Language.git
cd Juslyn-Programming-Language

2. Requirements

  • Python 3.8+
  • No external libraries needed — Juslyn is built in pure Python.

3. Run the Interpreter (REPL)

python shell.py

You’ll see:

Juslyn v1.0.0 >

This is the interactive REPL where you can run Juslyn code:

Juslyn v1.0.0 > PRINT("Hello Juslyn!");
Hello Juslyn!

4. Running a Program File

Create a file called HelloWorld.juslyn:

PRINT("Hello, World!");

Run it from the REPL:

Juslyn v1.0.0 > RUN("HelloWorld.juslyn")
Hello, World!

📖 Juslyn Syntax Cheatsheet

Keyword / Syntax Description
POCKET x = 10; Declare a variable with value 10
PRINT(x); Print value of x
"Hello " + name Concatenate strings
a ~ b Raise a to the power of b
CHECK cond THEN ... OTHERWISE ... FINISH; If-else statement
REPEAT i = 0 TO 10 STEP 1 THEN ... FINISH; Loop from 0 to 10 (step 1)
TASK name(args) ... SEND value; Define a function
APPEND(list, val); Add item to list
LEN(list) Get length of a list
RUN("file.juslyn") Run another Juslyn program
SEND value; Return from a function
FINISH; End a block (loop, function, or conditional)

🔎 Syntax Examples

Variables & Printing

POCKET name = "Juslyn";
POCKET year = 2025;
PRINT("Welcome to " + name + " in " + year);

Math

POCKET a = 5;
POCKET b = 2;
PRINT("a + b = " + (a + b));
PRINT("a - b = " + (a - b));
PRINT("a * b = " + (a * b));
PRINT("a / b = " + (a / b));
PRINT("a power b = " + (a ~ b));

Conditionals

POCKET n = 10;
CHECK n > 5 THEN
  PRINT(n + " is greater than 5");
OTHERWISE
  PRINT(n + " is not greater than 5");
FINISH;

Loops

REPEAT i = 1 TO 5 STEP 1 THEN
  PRINT("Loop index: " + i);
FINISH;

Functions & Recursion

TASK factorial(n)
  CHECK n == 0 THEN
    SEND 1;
  FINISH;
  SEND n * factorial(n - 1);
FINISH;

PRINT("Factorial of 5 = " + factorial(5));

Lists

POCKET nums = [];
APPEND(nums, 100);
APPEND(nums, 200);
PRINT("Numbers: " + nums);
PRINT("Length = " + LEN(nums));

📂 Demo Programs

The repo includes 5 demo programs (ready to run):

  • HelloWorld.juslyn → Minimal “Hello World”
  • Math.juslyn → Variables & arithmetic
  • FunctionsLists.juslyn → Recursion + lists
  • ControlFlow.juslyn → If/else + loops
  • Hardcore.juslyn → Tower of Hanoi recursion

Run them directly:

RUN("Math.juslyn")

⚙️ How It Works

Under the hood, Juslyn is a Python-based interpreter.

  1. Lexer → Converts raw code into tokens (POCKET, PRINT, 123, "string", etc).
  2. Parser → Builds an Abstract Syntax Tree (AST) from tokens.
  3. Interpreter → Walks through the AST and executes the logic.

This mirrors how real-world languages like Python, Java, or C are executed — but in a much simpler way, so anyone can study and extend it.


🧑‍💻 Example REPL Session

Juslyn v1.0.0 > RUN("HelloWorld.juslyn")
Hello, World!

Juslyn v1.0.0 > RUN("Math.juslyn")
a = 10
b = 5
a + b = 15
a - b = 5
a * b = 50
a / b = 2
a power b = 100000

📜 License

MIT License – free to use, modify, and share. Created By : Justin Thomas


About

Juslyn is a simple, interpreted programming language crafted for learning language design and implementation. With clear syntax, variables, arithmetic, conditions, and functions, Juslyn is ideal for beginners and hobbyists seeking to understand how programming languages work from the ground up.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages