Skip to content

berlinbrown/ImperativeStaticCompiledLangOneFile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OctaneMini — Imperative Static Compiled Language (one-file)

What is this project? 💡

OctaneMini is a tiny proof-of-concept programming language that compiles a single source file into JVM bytecode. The compiler and runtime are implemented in Java; the intended use is experimental and educational — to demonstrate parsing and manual JVM classfile emission.


Quick start 🔧

  • Build the module:

    • From the module folder: cd newUpdates/ImperativeStaticCompiledLangOneFile && mvn package
    • From repo root: mvn -f newUpdates/ImperativeStaticCompiledLangOneFile/pom.xml package
  • Run the compiler (no args will read main.octane and write Main.class):

    • With Java: java -cp target/octaneLangSimpleStaticCompiled-1.0.0.jar org.berlin.staticlang.CompiledLangOneFile
    • With Maven exec: mvn -f newUpdates/ImperativeStaticCompiledLangOneFile/pom.xml exec:java -Dexec.mainClass="org.berlin.staticlang.CompiledLangOneFile"
  • Verify output: javap -c Main.class (or javap -v Main.class) to inspect generated bytecode.


Key files & structure 📂

  • newUpdates/ImperativeStaticCompiledLangOneFile/src/org/berlin/staticlang/CompiledLangOneFile.java — entry point, lexer, parser, AST, and visitor that drives compilation.
  • newUpdates/ImperativeStaticCompiledLangOneFile/src/org/berlin/staticlang/Code.java — bytecode emitter helpers and code buffer logic.
  • newUpdates/ImperativeStaticCompiledLangOneFile/src/org/berlin/staticlang/JavaCompilerHelper.java — JVM constants, constant pool helpers, and class file builders.
  • newUpdates/ImperativeStaticCompiledLangOneFile/main.octane — example source used when no CLI argument is provided.

Note: doc/ directories contain copy/demos; prefer editing code under src/.


Conventions & important notes ⚠️

  • Java compatibility: the module targets Java 1.5 (see pom.xml properties). Avoid changes that assume newer classfile features unless intentional.
  • The compiler builds JVM classfiles manually (constant pool, attributes, code sections). Use JavaCompilerHelper.ByteCodes constants when modifying opcodes.
  • Parser style: recursive-descent + visitor (ProgramVisitor) — most grammar/tokenization logic is in CompiledLangOneFile.

Development workflow ✅

  1. Make focused changes in src/ files. Avoid editing doc/ copies unless documentation updates are intended.
  2. Build: mvn -f newUpdates/ImperativeStaticCompiledLangOneFile/pom.xml package.
  3. Run compiler and inspect Main.class with javap -c Main.class.
  4. Add small tests under test/ when adding behaviors; toggle Surefire skipTests in pom.xml to run them in CI.

Contact & history

Author: Berlin Brown — see repository for license and historical notes.

About

Imperative Compiled Language in One Source File for the JVM

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages