Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
extern "C" {
void printi(int i) {
printf("%d\n", i);
}
// 型クラスA
typedef void (*A_p)(struct A*);
struct A {
printi(i:int):void = printf("%d\n", i)
A:trait {
p():void = printi(1)
}
C <: A = struct(i:int) {
p():void = printi(i)
}
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/variant/recursive_variant.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <iostream>
#include <vector>
#include <string>
#define rw boost::recursive_wrapper
@hsk
hsk / dachs_grammer.md
Last active August 29, 2015 14:21
dachs language grammer

キーワード

true false do end var new begin let in as if unless then elseif else static_array pointer typeof ret case when for ensure init copy cast class import

symbol ::= expression の形式で文法要素を表します。( ... ) はグループを (^ ... ) は否定、|は選択、{ ... } は0回以上の繰り返し、{^ ... } が否定の0回以上の繰り返し、+ は1回以上の繰り返しを表します。

eol         ::= '\n' /* end of line */
eoi         ::= end of input
eps         ::= qi::eps
@hsk
hsk / a.scala
Last active August 29, 2015 14:24
named visitor
package a
trait E {
def visit[T](v:EVisitor[T]):T
}
class EInt(a:Int) extends E {
def visit[T](v:EVisitor[T]):T = v.EInt(a)
}
class EBin(a:E,op:String,b:E) extends E {
def visit[T](v:EVisitor[T]):T = v.EBin(a,op,b)
}
@hsk
hsk / calc.ml
Last active October 8, 2015 11:01
calc.ml
type c =
| Int of int
| Add
| Sub
| Load of string
| Save of string
| Ret
let rec lookup e v =
match e with
@hsk
hsk / gist:d1b4274a7153da9c7db3
Created December 4, 2015 02:26
atom transparent style.less
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/
@textfade: rgba(0,0,0,1.0);
# Klassic言語仕様
## Klassicの開発ポリシー
基本的にScalaを改良しつつ、最初はコアな機能を作成し、パーシャルファンクション等の細かい機能は後からつける。
EOF ::= not(elem(".", (ch: Char) => ch != CharSequenceReader.EofCh), "EOF Expected")
LINEFEED ::= ("\r\n" | "\r" | "\n")
SEMICOLON ::= ";"

lit language spec

Syntax Summary

Lexical Syntax

white_space ::= ' ' | '\r' | '\n' | '\t'
ident       ::= ('a'|...|'z'|'A'|..|'Z'|'_')('a'|...|'z'|'A'|..|'Z'|'_'|'0'|...|'9')*
number      ::= ('0'|...|'9')+
%{
open Source
open Types
open Kernel
open Ast
open Script
(* Error handling *)