Skip to content

Commit

Permalink
Prepare for release.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcort committed Feb 22, 2015
1 parent 8c21204 commit dbbd30c
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 28 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See https://github.com/tcort/tcb/graphs/contributors
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See https://github.com/tcort/tcb/commits/master
5 changes: 4 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ CLEANFILES = $(BUILT_SOURCES) \
hello.out \
remainder.out

EXTRA_DIST = $(man_MANS) $(top_srcdir)/test-runner.sh \
EXTRA_DIST = \
$(man_MANS) \
test-runner.sh \
README.md \
abs.sh abs.bas abs.ex \
fib.sh fib.bas fib.ex \
hello.sh hello.bas hello.ex \
Expand Down
62 changes: 42 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
# tcb

tcb is a small BASIC Interpreter written in C.
tcb is a small [BASIC](http://en.wikipedia.org/wiki/BASIC) Interpreter
written in C.

## Current Status

Under active development.

## Road to v1.0.0

The following components are complete:

* Scanner
* Parser
* Abstract Syntax Tree
* Man page

The following components are in progress:

* Unit Tests

The following components remain:

* i18n/l10n
The "basics" are done and working. The interpreter implements the
[Tiny BASIC](http://en.wikipedia.org/wiki/Tiny_BASIC) dialect of BASIC.
Development will continue with the goal of implementing successively more
complete dialects of BASIC.

## Requirements

* [C compiler](http://www.gnu.org/software/gcc/) and standard build tools ([make](http://www.gnu.org/software/make/), [sh](http://www.gnu.org/software/bash/), ...).
* [flex](http://www.gnu.org/software/flex/) - buildtime
* [bison](http://www.gnu.org/software/bison/) - buildtime
* [diff](http://www.gnu.org/software/diffutils/) - buildtime (running unit tests)
* [sed](https://www.gnu.org/software/sed/) - buildtime (running unit tests)
* [sed](http://www.gnu.org/software/sed/) - buildtime (running unit tests)
* [autoconf](http://gnu.org/software/autoconf) - development time
* [automake](http://gnu.org/software/makeconf) - development time

## Building

Expand All @@ -38,6 +27,7 @@ Standard autotools build:
$ autoreconf -i
$ ./configure
$ make
$ make check
# make install

## Using
Expand All @@ -50,6 +40,38 @@ Execute a program from a file in batch mode:

$ tcb sample.bas

## Example Program

The following program calculates
[Fibonacci numbers](http://en.wikipedia.org/wiki/Fibonacci_number)
and demonstrates all of the available statements. It's included
in the sources as `sample.bas`:

10 PRINT "How many fibonacci numbers should I calculate?"
20 INPUT X
30 IF X <= 2 THEN GOTO 10
40 PRINT "Calculating the first ",X," fibonacci numbers: "
50 PRINT "fib[0] = 0"
60 PRINT "fib[1] = 1"
70 LET J = 1

100 LET J = J + 1
110 LET A = 0
120 LET B = 1
130 LET I = 1
140 GOSUB 1000
150 PRINT "fib[",J,"] = ",C
160 IF J < X-1 THEN GOTO 100
170 END

1000 LET C = B + A
1010 LET T = B
1020 LET B = C
1030 LET A = T
1040 LET I = I + 1
1050 IF I = J THEN RETURN
1060 GOTO 1000

## Contributing

1. Fork it
Expand Down
21 changes: 19 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
* Unit Tests
* i18n/l10n
Implement additional commands:

* QUIT
* SAVE filename
* LOAD filename

Implement additional statements:

* FOR/NEXT

Implement language fundamentals:

* Strings
* Floating point

Other changes:

* Better error handling / reporting.
* Move away from flex and bison.
29 changes: 24 additions & 5 deletions sample.bas
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
10 LET A = 2
20 LET B = 2
30 LET C = A + B
40 PRINT A, "+", B, "=", C
50 END
10 PRINT "How many fibonacci numbers should I calculate?"
20 INPUT X
30 IF X <= 2 THEN GOTO 10
40 PRINT "Calculating the first ",X," fibonacci numbers: "
50 PRINT "fib[0] = 0"
60 PRINT "fib[1] = 1"
70 LET J = 1

100 LET J = J + 1
110 LET A = 0
120 LET B = 1
130 LET I = 1
140 GOSUB 1000
150 PRINT "fib[",J,"] = ",C
160 IF J < X-1 THEN GOTO 100
170 END

1000 LET C = B + A
1010 LET T = B
1020 LET B = C
1030 LET A = T
1040 LET I = I + 1
1050 IF I = J THEN RETURN
1060 GOTO 1000

0 comments on commit dbbd30c

Please sign in to comment.