Code Monkey home page Code Monkey logo

tinyscheme's Introduction

TinyScheme R7

Latest version is 20.10 | Emulator | Project WebSite | Downloads with binaries

Disclaimer: this repo respects original authors and there is no intention to take over their fame. It's branched to implement some features from the modern R7RS standard, to fix some old bugs and tailor it for use in educational purposes.

About

This is small Scheme language implementation written in C language. Obvious usages are:

  • as a tiny engine for running plugins and other extensions in your C/C++ program (suppose you want to change some part of logic of your program without recompiling it every time).
  • as a sandbox to learn the language (as it supports most features except those which will make implementation not "tiny")
  • as utility script-running tool, even to create CGI-scripts for web-server

The original is principally developed as tinyscheme.sourceforge.net.

This offspring was cloned from rev125 there. Currently my wish is to bring it bit closer to R7RS-small standard (original is close to R5RS of 1998).

Recent Changes and Improvements:

  • basic bytevector functions implemented
  • UTF-8 is now supported in strings and characters with minor limitation of case-conversion not extended above ASCII range
  • symbols are case-sensitive by default (to match R6RS, R7RS and speed-up a bit)
  • fixes for various bugs (many of them found in "open" state in original repo)
  • tests in simple shell scripts are added
  • removed some old unused code (eg. objlist implementation)
  • code cleanup / formatting (with indent -br -brs -brf -nut -ci4 -nlp -npsl -npro -npcs -ce *.c)

tinyscheme's People

Contributors

rodiongork avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tinyscheme's Issues

Integer size

Not critical, but it would be nice to control

  • gcc in ubuntu on 64-bit machine uses long of 8 bytes inside of num struct
  • mingw with its own gcc seemingly has long of 4 bytes instead.

Ideally it would be great to specify explicitly during the build time.

backchar internal doesn't respect port

This may require testing, but it seems we have single variable for backchar (like ungetc), despite having many ports. So backchar called on stdin and then immediately on some file should be owerwritten, which is no good.

vector-copy! as per R7RS

There is no efficient way to copy vector (besides (list->vector (vector->list s))) but R7RS introduces vector-copy, vector-copy! and vector-append. It looks like the second of them could be implemented internally and two others as library procedures.

char-ready and peek-char

The functions char-ready? and peek-char most probably are not working properly (and perhaps never were due to #3). Also consider bytewise versions peek-u8 and u8-ready?

read-line implementation

Small but painful thing missing in R5RS is (read-line) procedure. This could be added as library function to save core code size.

Support UTF-8 for symbols (optional)

UTF-8 is now working for strings and characters, but not for symbols, e.g.

(symbol->string 'bั‹)

Returns broken string with length of 1. This is because symbols are based on internal string representation, but this representation for unicode (with 4-byte chars for fast indexing) is not compatible with symbol-related internal functions.

This could be fixed if, instead, symbols have their own internal representation or rely on bytevector.

However it is not critical feature of course as the idea of using non-ascii characters in "symbols" (e.g. for parts of program code)
is strongly discouraged. So it more makes sense for consistency.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.