Skip to content

Instantly share code, notes, and snippets.

class Transform < Parslet::Transform
rule(:integer => simple(:int)) { AST::IntLiteral.new int }
rule(:args => simple(:arg)) { AST::SelectArgs.new [arg] }
rule(:args => sequence(:args)) { AST::SelectArgs.new args }
rule(:integer_argument => simple(:int)) { AST::IntArgument.new int}
rule(:column_argument => simple(:name)) { AST::ColumnArgument.new name}
rule(:select => simple(:select),
:args => simple(:args),
:table_name => simple(:from) ) { AST::FromSelect.new args, from}
rule(:select => simple(:select),
@baroquebobcat
baroquebobcat / release_notes.md
Last active December 20, 2015 16:29
Mirah Release 0.1.1

[ANN] Mirah 0.1.1 Released

Hey everybody, Mirah 0.1.1 has been released! This release has been a long time coming, 383 commits. Considering the repository only has had 1627 commits so far, that's a lot of changes.

Ryan Brown's work on self-hosting continues:

  • The typer has moved further into Mirah
  • The new self-hosted backend
  • The new mirror type system
@baroquebobcat
baroquebobcat / tableme.rb
Created July 30, 2013 23:11
Git Project Language Blob Overtime
# calculates language blob values ala github over time
# requires the github-linguist gem
#
# It's how I made this pretty graph http://www.flickr.com/photos/baroquebobcat/9401947827/
require 'rubygems'
require 'linguist'
require 'date'
def each_day start, finish
(start..finish).each do |day|
@baroquebobcat
baroquebobcat / rough_mirah_nlr.diff
Last active December 20, 2015 01:29
Really rough attempt at hacking non local return into Mirah's closure building
diff --git a/src/org/mirah/typer/closures.mirah b/src/org/mirah/typer/closures.mirah
index e07327f..46e31a0 100644
--- a/src/org/mirah/typer/closures.mirah
+++ b/src/org/mirah/typer/closures.mirah
@@ -17,6 +17,8 @@ package org.mirah.typer
import mirah.lang.ast.*
import java.util.Collections
+import java.util.List
+import java.util.ArrayList
@baroquebobcat
baroquebobcat / why_with.py
Created June 10, 2013 18:01
With as impl w/ for
# Why is there a with construct, when you can build it with
# for loop and yield?
#
# ;)
def open_f(filename, mode):
try:
f = open(filename, mode)
yield f
finally:
@baroquebobcat
baroquebobcat / notes.md
Last active December 17, 2015 16:18
Mirah Assignment corner cases

Multiple Assignment general cases

The fundamental question is whether the return type of an assignment is rhs's type or lhs's.

#  B = C => ?
   b = c
@baroquebobcat
baroquebobcat / gist:5518269
Created May 4, 2013 18:11
railties errors
1) Failure:
ApplicationTests::AssetDebuggingTest#test_assets_aren't_concatenated_when_compile_is_true_is_on_and_debug_assets_params_is_true [test/application/asset_debugging_test.rb:60]:
Expected /<script src="\/assets\/application-([0-z]+)\.js\?body=1"><\/script>/ to match "<!DOCTYPE html>\n<html>\n<head>\n <title>We're sorry, but something went wrong (500)</title>\n <style>\n body {\n background-color: #EFEFEF;\n color: #2E2F30;\n text-align: center;\n font-family: arial, sans-serif;\n }\n\n div.dialog {\n width: 25em;\n margin: 4em auto 0 auto;\n border: 1px solid #CCC;\n border-right-color: #999;\n border-left-color: #999;\n border-bottom-color: #BBB;\n border-top: #B00100 solid 4px;\n border-top-left-radius: 9px;\n border-top-right-radius: 9px;\n background-color: white;\n padding: 7px 4em 0 4em;\n }\n\n h1 {\n font-size: 100%;\n color: #730E15;\n line-height: 1.5em;\n }\n\n body > p {\n width: 33em;\n margin: 0 auto 1em;\n padding
@baroquebobcat
baroquebobcat / sake_plans
Created March 12, 2013 17:41
Sake Plans
Plan
酒元
酒元 Mar 9 steam rice, mix w/ koji in fermenter
酒元 Mar 10 morning: stir, evening: stir
酒元 Mar 11 morning:
stir,
cool -- thinking, put fermenter in water bath in rubbermade tub w/ an ice bottle
evening:
@baroquebobcat
baroquebobcat / notes.md
Last active December 11, 2015 10:38
Mirah Classloading

really need to think of there being 2 environments:

  • compiler
  • compilee/compilation/something

compiler includes all the compiler's bits like

  • Parser (AST, etc)
  • Typer
  • Intrinsics, Base Extensions
  • User Extensions.
@baroquebobcat
baroquebobcat / polluted.rb
Created November 8, 2012 17:38 — forked from ahoward/polluted.rb
ruby libs have *got* to stop doing this...
libs = ARGV.size == 0 ? all_gems : ARGV
list =
libs.
forkify(16){|lib| puts "#{ lib }..."; [lib, polluted_by(lib)]}.
sort_by{|pair| pair.last}
list.each do |lib, polluted|
puts "polluted_by('#{ lib }') #=> #{ polluted }"