Project

sbyc

0.0
No commit activity in last 3 years
No release in over 3 years
Tools around Ruby and Types
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

SByC – Investigating Specialization by Constraint

SYNOPSIS

SByC is an investigation about Specialization by Constraint as an alternative to common type systems that we found in (object-oriented) programming languages. The library is written as a collection of Ruby tools described below. Those tools are in fact sub-gems of SByC that can often be used in isolation.

CodeTree

This part of SByC provides a safe, reusable, extensible, mashallable, and non-intrusive (no monkey patching of Ruby core classes) implementation of block expressions. Block expressions are parsed using a generic DSL and converted to a parse tree, which may be analyzed, rewrited, compiled, and so on. The example below illustrates typical usage of CodeTree.

code = CodeTree::parse{ x > 10 & y < 20 }   
# => (& (> x, 10), (< y, 20))

# See the evaluation section for details
code.eval{:x => 5, :y => 5}                
# => true

# See the code-generation section for details
code.object_compile('scope', :[])          
# => "scope[:x].>(10) & scope[:y].<(20)"

# CodeTree expressions may be marshaled
Marshal.dump(code)

Learn more about CodeTree

TypeSystem

This part of SByC implements a TypeSystem abstraction. A type is simply collection of values. A type system is to generate and parse literals and to coerce from String values.

TypeSystem::Ruby::type_of(-125)
# => Fixnum

lit = TypeSystem::Ruby::to_literal(-125)
# => "-125"

TypeSystem::Ruby::parse_literal("-125")
# => -125

TypeSystem::Ruby::coerce('-125', Integer)
# => -125

Learn more about TypeSystem

INSTALL

gem install sbyc

DOCUMENTATION

  • The official documentation can be found on GitHub pages
  • The api documentation can be found on rdoc.info

CONTRIBUTE

Fork the project on github, make a contrib, and send me a pull request

CREDITS

SByC © 2010 by Bernard Lambeau. SByC is distributed under the MIT licence. Please see the LICENCE.md document for details.