• Stars
    star
    246
  • Rank 164,726 (Top 4 %)
  • Language
    Scala
  • License
    MIT License
  • Created over 15 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An embedded Insane-specific Language for Scala implementing the BASIC programming language

BAYSICK - an embedded Insane-specific Language for Scala implementing a subset of BASIC

Here is a small example:

    object SquareRoot extends Baysick {
      def main(args:Array[String]) = {
        10 PRINT "Enter a number"
        20 INPUT 'n
        30 PRINT "Square root of " % "'n is " % SQRT('n)
        40 END
    
        RUN
      }
    }

Here is a larger example

    object Lunar extends Baysick {
      def main(args:Array[String]) = {
        10 PRINT "Welcome to Baysick Lunar Lander v0.0.1"
        20 LET ('dist := 100)
        30 LET ('v := 1)
        40 LET ('fuel := 1000)
        50 LET ('mass := 1000)
    
        60 PRINT "You are a in control of a lunar lander."
        70 PRINT "You are drifting towards the surface of the moon."
        80 PRINT "Each turn you must decide how much fuel to burn."
        90 PRINT "To accelerate enter a positive number, to decelerate a negative"
    
        100 PRINT "Distance " % 'dist % "km, " % "Velocity " % 'v % "km/s, " % "Fuel " % 'fuel
        110 INPUT 'burn
        120 IF ABS('burn) <= 'fuel THEN 150
        130 PRINT "You don't have that much fuel"
        140 GOTO 100
        150 LET ('v := 'v + 'burn * 10 / ('fuel + 'mass))
        160 LET ('fuel := 'fuel - ABS('burn))
        170 LET ('dist := 'dist - 'v)
        180 IF 'dist > 0 THEN 100
        190 PRINT "You have hit the surface"
        200 IF 'v < 3 THEN 240
        210 PRINT "Hit surface too fast (" % 'v % ")km/s"
        220 PRINT "You Crashed!"
        230 GOTO 250
        240 PRINT "Well done"
    
        250 END
    
        RUN
      }
    }

Enjoy.

note: The BASIC programming language is 50 years old

License

Copyright 2010-2014, Michael Fogus Licensed under the MIT License.
Redistributions of files must retain the above copyright notice.

More Repositories

1

lemonad

a functional programming library for javascript. an experiment in elegant JS.
JavaScript
658
star
2

thunks

posts and code related to personal studies
374
star
3

himera

JavaScript
279
star
4

ulithp

A micro LISP implementation in 24 lines of Ruby.
Ruby
270
star
5

papers-i-love

Computer science and computer-adjacent papers (and sometimes books) that have influenced me deeply.
261
star
6

lithp

McCarthy's Lisp in Python with macros. A celebration of 50+ years of symbolic processing.
Python
257
star
7

trammel

Contracts programming with Clojure
Clojure
242
star
8

bacwn

clojure + datalog = <3
Clojure
137
star
9

minderbinder

converting one thing into another thing via Clojure.
Clojure
88
star
10

codd

a relational algebra library for JavaScript
JavaScript
60
star
11

skiing

a clojure combinator zoo
Clojure
44
star
12

tori-lisp

an ersatz lisp for tiny birds. a code riff.
JavaScript
42
star
13

evalive

various eval functions and macros for use with clojure. a code riff.
Clojure
33
star
14

unfix

Infix and Postfix library for Clojure that was cut from the book.
Clojure
31
star
15

lang-genealogy

Forth
9
star
16

reinen-vernunft

Code conversations in Clojure regarding the application of pure reasoning algorithms.
Clojure
8
star
17

tathata

An implementation of Clojure pods.
Clojure
7
star
18

thneed

An eclectic set of Clojure utilities that I've found useful enough to keep around.
Clojure
5
star
19

gamut-of-games

a repository of rules for games in text formats
4
star
20

fogos

Assembly
3
star
21

russ-forth

Russforth is a teeny-tiny Forth-esque implementation in Ruby.
Ruby
3
star
22

tafl

a clojure library to manipulate and query table-like data structures.
Clojure
3
star
23

spec-experiments

Clojure
1
star
24

battlestation

a description of my home battle station
1
star
25

abs-oddity

Clojure
1
star