GithubHelp home page GithubHelp logo

ethowitz / sruby Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 135 KB

An increasingly less miniature implementation of Ruby in Scala

License: GNU General Public License v3.0

Scala 99.69% Ruby 0.31%
functional-programming programming-languages ruby scala

sruby's Introduction

Hi there ๐Ÿ‘‹

sruby's People

Contributors

ethowitz avatar

Watchers

 avatar

sruby's Issues

Build DSL for syntax tree construction

Build a DSL to make it easier to write ruby methods using abstract syntax. I don't know if this is actually a good idea or whether it would be overkill. We should research how other languages written in functional languages deal with predefined methods written in the host language.

In scala, we may be able to accomplish this by subclassing or composing core scala classes/methods with our AST classes

Add constant support

  • Constant assignment (only allowed globally, in classes, and in modules)
  • Constants should be stored in a tree
  • Might want to replace KlassMap with ConstantMap, which would store the values of every constant (not just classes)
  • Module support should be added at the same time

Add additional abstract syntax for invocations

Will improve Evaluator#evalInvocation

  • InvocationWithImplicitReceiver

also

  • ivars are not method invocations and should have separate abstract syntax
  • we will still need to handle local var vs implicit receiver method calls during AST evaluation

Add arrays

Add array literal syntax and core methods

Improve Ruby errors

Compose Either and State to handle errors as part of the state being passed in the evaluator monad

Also disallow throw via wartremover

Also add raise/rescue support and some basic exceptions

Clean up parser

Clean up the parser by introducing nested functions/local variables to break up patterns and make things more readable.

Also look into:

  • packrat parsing to see about using an easier-to-understand left recursive grammar
  • Co-opting the yacc files from jruby or ruby and using a Java yacc library

Add hashes

Add hash literal syntax and core methods

Improve style consistency

Be consistent about:

  • Naming
  • Max line length
  • Where to break lines
  • How to deal with long class and method definitions
  • Favor List.empty over List()

Fix warnings in console

scala> import com.ethowitz.sruby.core.RubyNilClass
<console>:11: warning: Unused import
       import com.ethowitz.sruby.core.RubyNilClass
                                      ^
error: No warnings can be incurred under -Xfatal-warnings.

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.