GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - maximecb/kavascript: Minimalistic dynamically-typed programming language for didactic purposes.

This repository was archived by the owner on Oct 8, 2023. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

88 Commits
88 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
.gitignore
.gitignore
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
main.rs
main.rs
 
 
parser.rs
parser.rs
 
 
runtime.rs
runtime.rs
 
 
vm.rs
vm.rs
 
 

Repository files navigation

KavaScript

Simple, dynamically-typed toy programming language for fun/didactic/tutorial purposes. Implemented in Rust. The codebase is intentionally kept small, easy to read and is well-commented.

I wrote this to demonstrate how easy it is to roll your own simple and readable top-down recursive descent parser that will handle a grammar similar to C/JS/Rust/Python or Lisp. I also wanted to show that the old school distinction between parsing and lexing/tokenization is kind of arbitrary and doesn't really need to exist.

This project is also an experiment to see how far I could get with the idea of parsing source code directly into bytecode without generating an AST first. Parsing directly to bytecode can produce a faster parser but is probably not ideal for languages that want to do complex static analysis (e.g. type analysis). It should be relatively easy to modify this parser to generate an AST instead of bytecode if desired.

Features:

  • Syntax inspired by JS and C
  • Minimalistic by design
  • Top down recursive descent parser with support for infix expressions
  • No separation between parsing and tokenization/lexing
  • Source code is parsed into bytecode directly, without building an AST
  • Token-threaded, stack-based bytecode interpreter
  • Simple mark & sweep garbage collector

Limitations:

  • Currently has no arrays or objects

Installation

Clone this repository:

git clone [email protected]:maximecb/kavascript.git

Build and run the project:

# Run tests
cargo test

# Compiles project to ./target/debug/ksvm
carbo build

# For best performance, builds to ./target/release/ksvm
carbo build --release

# Run an example script
cargo run example.pls

About

Minimalistic dynamically-typed programming language for didactic purposes.

Topics

bytecode-interpreterdynamic-languagesinterpreterparserprogramming-languagerust

Resources

Readme
Apache-2.0 license
Activity

Stars

29 stars

Watchers

1 watching

Forks

13 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.