Skip to content

Latest commit

 

History

History
147 lines (121 loc) · 4.07 KB

README.md

File metadata and controls

147 lines (121 loc) · 4.07 KB

Dachs Programming Language

Build Status

Goals 🐕

  • Light to write (inspired by Ruby)
  • Strongly and statically typed
  • Native code efficiency
  • OOP
  • Immutability-aware
  • Familiar with functional features
  • Dog-friendly
# If 'var' is specified, the argument is copied and passed by value
# then mutable.  Otherwise, the argument is passed by reference then
# immutable. Variable definition has the same rule as this.
# Type of arguments and returned value are deduced automatically.

# If you want to specify the type of argument, you can use ':'.
# e.g.
#   func step_to(var first : float, last : float, block) : ()

func step_to(var first, last, block)
    for first <= last
        block(first)
        first += 1
    end
end

# UFCS is implemented.
# '1.step_to n' is equivalent to 'step_to(1, n)'

# Dachs has a block inspired from Ruby.
# do-end block is passed to the last argument of callee as lambda object.
# Here, 'block' variable is captured into do-end block.

func fizzbuzz(n, block)
    1.step_to n do |i|
        case
        when i % 15 == 0
            block("fizzbuzz")
        when i %  3 == 0
            block("fizz")
        when i %  5 == 0
            block("buzz")
        else
            block(i)
        end
    end
end

func main
    fizzbuzz 100 do |i|
        println(i)
    end
end

# Array and tuple are available as container.
# (dictionary will come.)

Progress Report

  • Basic literals
  • Basic expressions
  • Basic statements
  • Basic strong type check
  • Functions
  • Operator functions
  • Overload resolution
  • Simple return type and variable type deduction
  • Type inference
  • UFCS
  • Class
  • Lambda
  • Block
  • Variadic arguments
  • Module
  • Tests
  • CMakeLists.txt
  • Travis-CI
  • Option parser
  • Allocator customization
  • Introduce OvenToBoost

This software is disributed under The MIT License if not specified in a source file.

Copyright (c) 2014 rhysd

This software uses Boost C++ Libraries, which is licensed by The Boost License.

Boost Software License - Version 1.0 - August 17th, 2003

This software uses LLVM, which is licensed by University of Illinois/NCSA Open Source License.

Copyright (c) 2003-2014 University of Illinois at Urbana-Champaign