white_space ::= ' ' | '\r' | '\n' | '\t'
ident ::= ('a'|...|'z'|'A'|..|'Z'|'_')('a'|...|'z'|'A'|..|'Z'|'_'|'0'|...|'9')*
number ::= ('0'|...|'9')+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Syntax of SortOfWhile */ | |
% Statements | |
stm(skip()). | |
stm((S1; S2)) :- stm(S1), stm(S2). | |
stm(X = E) :- atom(X), aexp(E). | |
stm(if(E, S1, S2)) :- bexp(E), stm(S1), stm(S2). | |
stm(while(E; S)) :- bexp(E), stm(S). | |
stm(or(S1, S2)) :- stm(S1), stm(S2). | |
stm(par(S1, S2)) :- stm(S1), stm(S2). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
構文 | |
x, y, z 変数 | |
v ::= 値 | |
λ(x:T)t ラムダ | |
s, t, u ::= 項 | |
x 変数 | |
v 値 | |
x y 関数適用 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- initialization(main). | |
eval1(Ctx,L,Ctx_,V) :- print_term(L,[]),nl,eval(Ctx,L,Ctx_,V),!. | |
eval(Ctx,["set",X,E],[X=V|Ctx_],null) :- eval1(Ctx, E, Ctx_, V). | |
eval(Ctx,["get",X],Ctx,V) :- member(X=V, Ctx). | |
eval(Ctx,["+",E1,E2],Ctx2,V) :- eval1(Ctx,E1,Ctx1,V1),eval1(Ctx1,E2,Ctx2,V2), V is V1 + V2. | |
eval(Ctx,["=",E1,E2],Ctx2,V) :- eval1(Ctx,E1,Ctx1,V1),eval1(Ctx1,E2,Ctx2,V2), (V1 = V2,V=true;V=false). | |
eval(Ctx,["until",E1,E2],Ctx3,null) :- | |
eval1(Ctx,E1,Ctx1,V1), | |
(V1=true,Ctx3=Ctx1; eval1(Ctx1,E2,Ctx2,_),eval1(Ctx2,["until",E1,E2],Ctx3,_)). | |
eval(Ctx,["step"|[]],Ctx,null). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Featherweight Java on Prolog | |
Featherweight Javaは形式化されたJavaのシンプルなサブセットです。 | |
Featherweight Java on PrologはProlog上のDSLとしてFeatherweight Javaを実装したものです。 | |
Featherweight Java on Prologの構文はProlog上で実装しやすい形に書き換えてあります: | |
構文 | |
CL ::= クラス宣言: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
open Source | |
open Types | |
open Kernel | |
open Ast | |
open Script | |
(* Error handling *) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Klassic言語仕様 | |
## Klassicの開発ポリシー | |
基本的にScalaを改良しつつ、最初はコアな機能を作成し、パーシャルファンクション等の細かい機能は後からつける。 | |
EOF ::= not(elem(".", (ch: Char) => ch != CharSequenceReader.EofCh), "EOF Expected") | |
LINEFEED ::= ("\r\n" | "\r" | "\n") | |
SEMICOLON ::= ";" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type c = | |
| Int of int | |
| Add | |
| Sub | |
| Load of string | |
| Save of string | |
| Ret | |
let rec lookup e v = | |
match e with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |