Skip to content

Compiler written in Scala, which compile dialect of BASIC to C.

License

Notifications You must be signed in to change notification settings

BartekBH/tiny-basic-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple compiler written in Scala that compiles dialect of BASIC to C.

Language supports:

  • Numerical variables
  • Basic arithmetic
  • If statements
  • While loops
  • Print text and numbers
  • Input numbers
  • Labels and goto
  • Comments

Example code:

# Compute average of given values.

LET a = 0
WHILE a < 1 REPEAT
PRINT "Enter number of scores: "
INPUT a
ENDWHILE

LET b = 0
LET s = 0
PRINT "Enter one value at a time: "
WHILE b < a REPEAT
INPUT c
LET s = s + c
LET b = b + 1
ENDWHILE

PRINT "Average: "
PRINT s / a

What I learned while this project:

About

Compiler written in Scala, which compile dialect of BASIC to C.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages