Created
July 21, 2015 06:48
-
-
Save marionette-of-u/e51a5700fe114a43aa27 to your computer and use it in GitHub Desktop.
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
| 疑似言語Tiel・構想 | |
| // カンマ演算子で得た値を再帰的に保存する | |
| class comma<class TypeA, class TypeB>{ | |
| TypeA lhs; | |
| TypeB rhs; | |
| }; | |
| // ブラケット演算子で得た値を保存する | |
| using bracket<class TypeA, class TypeB> = comma<TypeA, TypeB>; | |
| // まずカンマによる中置記法演算子を定義します | |
| [operator, left, priority_n] class TypeA x "," class TypeB y | |
| = { comma r; r.lhs = x; r.rhs = u; return r; } | |
| // 次にブラケットで囲う複数記号演算子<| comma_list |>を定義します | |
| [operator, priority_m] "<|" bracket<class TypeA, class TypeB> x "|>" | |
| = { return x; } | |
| // 以下の記述が利用できるようになります | |
| a = <| x, y, z |> | |
| // == { a.rhs == z; a.lhs.rhs == y; a.lhs.lhs == x; } | |
| // 課題 | |
| // 中置以外の演算子の優先順位をどう規定するか |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment