Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
/ respace Public archive

An interpreter and assembler for the Whitespace language written in C++

License

Notifications You must be signed in to change notification settings

thaliaarchi/respace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Respace

A compiler, interpreter, and assembler for the Whitespace language written in C++.

Features

  • Compiler
  • Interpreter
  • Transpiler
    • To Whitespace Assembly
    • From Whitespace Assembly
    • To C
  • Optimizer
  • Compresser

Features in italics are upcoming

Todo

  • Features
    • Floating point (2 arg) language extension
    • Flags
      • Specify alternate [Space]/[Tab]/[LF] chars
      • Empty number parsed as error or 0
      • Disable stack underflow checks
      • Specify Whitespace language version to use (copy and slide)
    • Optimizer
      • Identical consecutive pushes replaced with dup
      • Superfluous dup instructions removed
      • Consolidate stack underflow checks
      • Replace call and subsequent ret with jmp and no ret
      • Replace swap; drop with slide 1 to reduce instruction count.
      • Optimize tail recursion (replace call before ret with jmp) and convert other recursion to tail recursion
    • Transpiler
      • Apollo Guidance Computer compiler/transpiler
  • Whitespace Programs
    • Whitespace interpreter
    • Infix and postfix expression evaluator and converter
    • BF interpreter/compiler
  • Documentation
    • Language spec
  • Investigate
    • LLVM for compilation
    • Flex or another lexer

Ideas

  • Implement heap by using 0-9 (or any range) as 'variables' on heap, then pushing positive heap addresses up by 10. Essentially creating a stack frame for each instance of the nested interpreter
  • Implement stack on stack by clearing stack of any temporary variables
  • Insert profile points to monitor code to find places that need optimization and less probable branches
  • Find wiki with list of optimization techniques
  • Could do interpreting the JVM way by identifying slow methods as it's running and optimizing those, then replacing future calls with calls to the optimized methods
  • Or do ahead of time compilation where it optimizes before it runs, then as it's running it can do other optimizations, but none of this is written to disk
  • Could compile to x86 assembly or machine code

About

An interpreter and assembler for the Whitespace language written in C++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages