Coder Social home page Coder Social logo

jcscheme's Introduction

JCScheme

The very first toy language I wrote for studying the essence of programing language.

JCScheme = Jiacai's Scheme ๐Ÿ˜Š

Concepts

1. S-expression

JCScheme use S-expression internally to represent AST like any other Scheme.

FYI, diagram below is the S-expression of (+ 1 2 (* 3 4)) behind SExpression.java. AST_demo

2. eval-apply cycle

As for evaluating code, JCScheme models after eval-apply cycle described in SICP 4.1

eval-apply cycle

More explanations can be found in my Chinese blog ใ€Šๆˆ‘็š„็ฌฌไธ€ไธช็Žฉๅ…ท่ฏญ่จ€ JCScheme ้—ฎไธ–ไบ†ใ€‹ใ€‚

Install

git clone [email protected]:jiacai2050/JCScheme.git
cd JCScheme; mvn clean package
java -jar target/JCScheme-*.jar

You can install rlwrap to support line editing, persistent history and completion.

# ubuntu
sudo apt-get install rlwrap
# centos
sudo yum install rlwrap
# Mac
brew install rlwrap  # for Homebrew
port install rlwrap  # for MacPorts

Then, run JCScheme like this

rlwrap java -jar target/JCScheme-*.jar

Syntax

  1. datatype
    • number
    • bool
    • string
    • pair
    • list
    • function
  2. builtin keywords
    • if
    • def
    • lambda
  3. builtin functions
    • bool: andใ€ orใ€ not
    • number: +ใ€ -ใ€ *ใ€ /ใ€ >ใ€ <ใ€ =
    • pair/list: consใ€ carใ€ cdrใ€ listใ€ null?
    • string: str=?ใ€
    • other: print

Code snippets can be found in ChangeLog

TODO

License

MIT License ยฉ Jiacai Liu

jcscheme's People

Stargazers

้ญ”ๆณ•ๅธˆ avatar

Watchers

James Cloos avatar

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.