Skip to content

stack-based programming language in Python for efficiency

Notifications You must be signed in to change notification settings

nishantXnova/Fastlang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README.md for FastLang

FastLang Logo FastLang

FastLang is a simple, stack-based programming language built in Python.
It converts source code (.fl files) into bytecode which runs on a lightweight Virtual Machine (VM).


πŸš€ Features

  • Stack-based execution for fast and efficient operations
  • Supports integers, variables, basic arithmetic, and print statements
  • Easily extendable for loops, conditions, and more
  • Minimal and clean design for learning language development

πŸ—‚οΈ Project Structure

FastLang/ β”‚ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ lexer.py # Tokenizer (for future extensions) β”‚ β”œβ”€β”€ compiler.py # Converts FastLang code β†’ bytecode β”‚ β”œβ”€β”€ bytecode.py # VM instruction set β”‚ β”œβ”€β”€ vm.py # Virtual Machine β”‚ └── init.py β”‚ β”œβ”€β”€ examples/ β”‚ └── test.fl # Example FastLang program β”‚ β”œβ”€β”€ main.py # Entry point to run programs β”œβ”€β”€ README.md # Project documentation β”œβ”€β”€ requirements.txt # No external dependencies └── .vscode/ └── launch.json # VS Code run configuration


πŸƒ How to Run

  1. Make sure Python 3.9+ is installed.
  2. Run the example bytecode in main.py:
python main.py


To run a .fl program:

from src.compiler import Compiler
from src.vm import VirtualMachine

compiler = Compiler()
bytecode = compiler.compile("examples/test.fl")

vm = VirtualMachine()
vm.run(bytecode)

✏️ Example .fl Program
let x = 10
let y = 5
print x + y


Output:

15

⚑ Efficiency

Stack-based operations for fast execution

Minimal runtime overhead

Easy to extend with new instructions

πŸ› οΈ Future Work

Add loops and conditionals

Add functions and reusable code

Syntax highlighting support

Error handling improvements

About

stack-based programming language in Python for efficiency

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages