Skip to content

tyirenkyi/teeny_tiny_compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Teeny Tiny compiler

I built this compiler by following Austin Henley's Teeny Tiny compiler blog series which is implemented in Python. The Teeny Tiny language is a dialect of BASIC. Teeny Tiny compiles to C code and this version of the compiler is implemented in Rust.

Future Support

Here are a list of features I'll be adding to improve the Teeny Tiny language:

  1. Parentheses for expressions
  2. Logical operators (and, or, not)
  3. ELSE IF and ELSE
  4. FOR loop
  5. Allow multiple code files
  6. Functions with parameters and return values
  7. Lexical scope
  8. Standard library
  9. Abstract syntax tree representation
  10. More primitive types
  11. Arrays
  12. Type checking
  13. More tests for the compiler

Currently Supported

  1. Numerical variables
  2. Basic arithmetic
  3. If statements
  4. While loops
  5. Print text and numbers
  6. Input numbers
  7. Labels and goto
  8. Comments

Instructions for use

  1. Create a file with teeny as the file extension. eg: hello.teeny
  2. Write your teeny program. eg program:
PRINT "How many fibonacci numbers do you want?"
INPUT nums

LET a = 0
LET b = 1
WHILE nums > 0 REPEAT
  PRINT a
  LET c = a + b
  LET a = b
  LET b = c
  LET nums = nums - 1
ENDWHILE	
  1. Pass file to the compiler with cargo run -- hello.teeny
  2. After successfully compiling to C code. You should find a C file called out.c in the root folder of the project.
  3. You can compile that with gcc if you have it installed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages