282 Commits 8b2080ec74 ... a466ddf9da

Author SHA1 Message Date
  mizusato a466ddf9da misc, fix 2 years ago
  mizusato 278c99d3bb share, fix 2 years ago
  mizusato b0dcfe9395 catch, retry, misc 2 years ago
  mizusato 4ddd18e0c3 buffer, misc, fix 2 years ago
  mizusato dbcb8123c6 distinct until changed 2 years ago
  mizusato 883575b89b with latest from, misc 2 years ago
  mizusato 6e51a44175 fork join 2 years ago
  mizusato 26de685667 combine latest 2 years ago
  mizusato ab3fa71c2f throttle, debounce, misc, fix 2 years ago
  mizusato a897f2e51d adjust 2 years ago
  mizusato dc8651c9fe take 2 years ago
  mizusato 30efa06e11 await, then, with 2 years ago
  mizusato e235fda0aa adjust 2 years ago
  mizusato fe2c46dc8d adjust 2 years ago
  mizusato 3cdd598f7b filter, scan, adjust 2 years ago
  mizusato c4c31cbf82 switch, exhaust 2 years ago
  mizusato 588727f0fa fix 2 years ago
  mizusato 13c066e596 concat, concurrent, adjust 2 years ago
  mizusato 3a9d73960b adjust 2 years ago
  mizusato 40a298f16a adjust 2 years ago
  mizusato 7c2cf15ce2 ob merge, adjust 2 years ago
  mizusato 74d5e58500 remove todo 2 years ago
  mizusato 0d5f457427 add todo 2 years ago
  mizusato dfecfef51c adjust 2 years ago
  mizusato 3446a14c54 fix 2 years ago
  mizusato 63a14afe09 adjust 2 years ago
  mizusato 40d33bf768 ob map, adjust 2 years ago
  mizusato f4cae9815c cancel functions 2 years ago
  mizusato 291b55cb8f go ctx, fix 2 years ago
  mizusato 78b69e1fe7 timer, adjust 2 years ago
  mizusato 9491c3b822 rx as part of core, adjust 2 years ago
  mizusato 311670b3fa adjust 2 years ago
  mizusato 5b7310ea1d update todos 2 years ago
  mizusato 3805fdf74a ob ctors, err ctor 2 years ago
  mizusato 160f615fe7 float int conversion 2 years ago
  mizusato 6a7cf2c175 change code mem repr to utf16, adjust 2 years ago
  mizusato 5729c89404 observable ops list, adjust 2 years ago
  mizusato 5776ddfaa3 queue, heap, fix, adjust 2 years ago
  mizusato e03218df08 adjust, fix 2 years ago
  mizusato a239b99a94 adjust 2 years ago
  mizusato 16c016e23c adjust, add todo 2 years ago
  mizusato 1460ec3587 map, fix, adjust 2 years ago
  mizusato 21f47d008b bytes, fix 2 years ago
  mizusato 4bbdc0dec7 encode decode 2 years ago
  mizusato fc7d851287 string ops 2 years ago
  mizusato eb68af0c38 adjust 2 years ago
  mizusato 7d73f792c3 str size 2 years ago
  mizusato 1f5290085b list sort 2 years ago
  mizusato 1a6aa0d9dc fix 2 years ago
  mizusato 3dee43b446 fix, set 2 years ago
  mizusato f7b90981d2 lambda compose 2 years ago
  mizusato 72b909be45 fix, str ctor, misc 2 years ago
  mizusato 94f152c0ba fix, list ops 2 years ago
  mizusato c47181a15b fix, list methods 2 years ago
  mizusato 3adfcbba0b to string, adjust 2 years ago
  mizusato e02d85fba3 more cmp 2 years ago
  mizusato d3aa6eb621 fix, bool, ordering 2 years ago
  mizusato 281b0cb3e3 fix, float ops 2 years ago
  mizusato 2841eecc05 adjust 2 years ago
  mizusato 299c358854 fix, undefined and assertion 2 years ago
  mizusato 3c1f143635 fix, crash 2 years ago
  mizusato e3eb971125 fix, int ops 2 years ago
  mizusato dd0775831b fix 2 years ago
  mizusato 25add4f707 basic types 2 years ago
  mizusato 3b303dde08 fix 2 years ago
  mizusato 61912d61fa fix 2 years ago
  mizusato e6e7b547d8 delete obsolete code 2 years ago
  mizusato ab07f9b1c9 fix 2 years ago
  mizusato ea1209dd3c change directory structure 2 years ago
  mizusato 58f34ab918 change directory structure 2 years ago
  mizusato dfe2be7b7c delete attr and name pkg 2 years ago
  mizusato 8ee7828e5f no limits 2 years ago
  mizusato c8716db064 fix 2 years ago
  mizusato 9c0c72edae replace typsys pkg 2 years ago
  mizusato dc9e84b2eb delete old code 2 years ago
  mizusato 7caea41387 runnable 2 years ago
  mizusato 8f7072fe27 compile project 2 years ago
  mizusato 2a21621c1f fix 2 years ago
  mizusato cb5bfede32 when, fix 2 years ago
  mizusato 14f0631bb0 adjust 2 years ago
  mizusato 83eaeed63c if, fix 2 years ago
  mizusato 1ef5eb0034 fix 2 years ago
  mizusato 2af9855b4e adjust 2 years ago
  mizusato a5b832924e add todo 2 years ago
  mizusato 6b366abae6 ref term errs 2 years ago
  mizusato 60dbb70065 check ref term, fix 2 years ago
  mizusato a3a5f06cbf new record, adjust 2 years ago
  mizusato 84f111bbc1 various calls, fix 2 years ago
  mizusato 4b9d8fbbd0 call fun ref, fix 2 years ago
  mizusato bf98f100d7 arguments, fix 2 years ago
  mizusato b8f4883d56 if multiple conds 2 years ago
  mizusato 715e980494 fix, call initial 2 years ago
  mizusato 9b3dacd122 cc infer 2 years ago
  mizusato 21a82db522 fix if 2 years ago
  mizusato 9c83ae76f6 linked list 2 years ago
  mizusato b2092f1e09 no public private 2 years ago
  mizusato a916dece80 simplify if 2 years ago
  mizusato 1fd5f331ff literals, adjust 2 years ago
  mizusato 8bb5f69598 interior ref 2 years ago
  mizusato 1e611bc527 fix 2 years ago
  mizusato 09b5e847ee adjust 2 years ago
  mizusato edf5eb6c90 new cps syntax 2 years ago
  mizusato 57693d6f8d fix 2 years ago
  mizusato 209e1d4fd6 adjust 2 years ago
  mizusato 8540b7f85f fix, method value 2 years ago
  mizusato dd89ef2286 no message 2 years ago
  mizusato f53a6de136 fix, enum to int 2 years ago
  mizusato 5b9afd4cf2 adjust 2 years ago
  mizusato f893365f16 adjust 2 years ago
  mizusato a9acf895c4 fix 2 years ago
  mizusato 159cb77167 fix, enum instead of union const 2 years ago
  mizusato 0c6472275a fix, cast 2 years ago
  mizusato 845fb0e2b1 fix 2 years ago
  mizusato 3d1e66837a adjust 2 years ago
  mizusato ac90c4063a fix, let 2 years ago
  mizusato e57c90fcaa fix, assign 2 years ago
  mizusato 882de9a803 fix, lambda 2 years ago
  mizusato 3a78f7faa4 fix 2 years ago
  mizusato 158df8ac66 fix 2 years ago
  mizusato c9fd63ea23 expr expand pipeline 2 years ago
  mizusato 82dc8f479c fix 2 years ago
  mizusato fd27643faf fix 2 years ago
  mizusato 55bb6e8fd4 expr func val 2 years ago
  mizusato 97e64891d6 fix, add todos 2 years ago
  mizusato 81576eb898 adjust 2 years ago
  mizusato 8164e60155 internal and external 2 years ago
  mizusato 450b3797ec header merge 2 years ago
  mizusato 2ddcb59d52 fix 2 years ago
  mizusato 4e43819b45 header limits and type validation 2 years ago
  mizusato 6924ebca9a dispatch table backward pointer 2 years ago
  mizusato 82c3ab4c52 fix 2 years ago
  mizusato bfb21efb76 adjust 2 years ago
  mizusato 40de62860d dispatch 2 years ago
  mizusato f2cd12b2fa header phases, fix 2 years ago
  mizusato 6ba490e1e6 header various functions 2 years ago
  mizusato b3ee0a2128 adjust 2 years ago
  mizusato f50020e75d header unify function, fix 2 years ago
  mizusato 28de4bf8b0 header function ordinary 2 years ago
  mizusato 9bccffab9b header types, fix 2 years ago
  mizusato 8fdd00e497 fix 2 years ago
  mizusato 82cd506199 register types, fix 2 years ago
  mizusato b33f7140f2 ref, name based ref type, source loader, header, fix 2 years ago
  mizusato 39d1bf04f2 backport constraints 2 years ago
  mizusato 83b3b53531 fix 2 years ago
  mizusato 4fe335d8e2 namespace instead of module 2 years ago
  mizusato ba661e3caa add todo 2 years ago
  mizusato 7d87551047 adjust 2 years ago
  mizusato 43da0c3bca rename builtin package 2 years ago
  mizusato 929ec1bcae adjust 2 years ago
  mizusato 9765d917af fix 2 years ago
  mizusato 8bc30d880a fix 2 years ago
  mizusato 99227580e2 migrate program (partial), lens 2 years ago
  mizusato 12c6c04fd1 adjust 2 years ago
  mizusato 2cd34129f1 adjust 2 years ago
  mizusato 4562f6e028 builtin interop native func 2 years ago
  mizusato 0dd83e9218 adjust 2 years ago
  mizusato d4b080a529 adjust 2 years ago
  mizusato acb2e8407a fix 2 years ago
  mizusato d8fe094346 fix syntax 2 years ago
  mizusato 0e48c87703 builtin interop lambda, fix 2 years ago
  mizusato fffe95ada9 fix 2 years ago
  mizusato 0bfc3d03b0 change directory structure 2 years ago
  mizusato 0b1c7ed9c9 runtime exception 2 years ago
  mizusato 3c49e19782 fix 2 years ago
  mizusato ca2a300f99 object interop record and container 2 years ago
  mizusato e60942c95a builtin initial 2 years ago
  mizusato ebeb3c4cb7 add todo 2 years ago
  mizusato ce6df684cc fix 2 years ago
  mizusato b137456fc0 change directory structure 2 years ago
  mizusato 52b99ac036 sam call and lambda 2 years ago
  mizusato 89158b9b3e sam conversion 2 years ago
  mizusato 2584f96423 to string 2 years ago
  mizusato abfcac2ecb fix syntax 2 years ago
  mizusato b2ae2f8a7a stdlib migrate vdom, adjust 2 years ago
  mizusato 3e422a4d1b stdlib migrate sys 2 years ago
  mizusato 33f7191cbc add todo 2 years ago
  mizusato 8eff82e19b fix 2 years ago
  mizusato fe12032b5d fix 2 years ago
  mizusato 466581ceda fix 2 years ago
  mizusato 1d2efb45f2 stdlib migrate core, fix 2 years ago
  mizusato 363852e202 stdlib migrate core base 2 years ago
  mizusato 41be183bf4 change directory structure 2 years ago
  mizusato e51ca9fbc4 adjust 2 years ago
  mizusato 79f9569f10 fix 2 years ago
  mizusato 0659f5bc94 migrate 2 years ago
  mizusato 67cb927a79 migrate 2 years ago
  mizusato d37598e1e1 add todo 2 years ago
  mizusato ca407ce8e2 fix 2 years ago
  mizusato 428ee92602 checker migrate when 2 years ago
  mizusato 814e8b4c87 adjust 2 years ago
  mizusato bae205fe20 checker migrate assign 2 years ago
  mizusato 64772111ed fix 2 years ago
  mizusato cbc359d13a fix 2 years ago
  mizusato cc4b97fa29 checker migrate expr interior 2 years ago
  mizusato 711b60c79d infix and variadic 2 years ago
  mizusato 0f660388a4 checker migrate expr block 2 years ago
  mizusato 105f248243 checker migrate expr lambda input 2 years ago
  mizusato 352f70df79 add todo 2 years ago
  mizusato afda928a5c checker migrate expr ctor call 2 years ago
  mizusato ef4bec3c72 checker migrate expr call 2 years ago
  mizusato 4fea461a3a checker migrate expr func ref call 2 years ago
  mizusato 5f500c8cf9 adjust 2 years ago
  mizusato 954d0600a3 checker migrate expr build record 2 years ago
  mizusato 222599c3be checker migrate expr structure 2 years ago
  mizusato a702d0cb31 checker migrate func body 2 years ago
  mizusato d45bc1262f adjust 2 years ago
  mizusato fb769823cd fix 2 years ago
  mizusato c738f2bb7d checker migrate func collect signature 2 years ago
  mizusato 114e107c4f checker migrate func collect preparation 2 years ago
  mizusato f47e39725a checker migrate func reg 2 years ago
  mizusato ccc28f3d37 checker migrate type related code 2 years ago
  mizusato 3626c9316c migrate typsys 2 years ago
  mizusato 4d57f756ed migrate manifest 2 years ago
  mizusato 088bbad3dc fix, migrate vd code gen 2 years ago
  mizusato 942db23a61 change vd format 2 years ago
  mizusato 4374d9ecc0 asset new mechanics 2 years ago
  mizusato 2b5c25b185 migrate manifest 2 years ago
  mizusato 86fbd4deb6 migrate manifest 2 years ago
  mizusato 7f379d7ef2 migrate vd 2 years ago
  mizusato 64a5cf8291 adjust 2 years ago
  mizusato 170650f91c refine 2 years ago
  mizusato 035a3815b4 no structural 2 years ago
  mizusato 2f00418ca0 adapter 2 years ago
  mizusato b18d801cff add ast util func 2 years ago
  mizusato 7b18ab2ed0 rename cs to ss 2 years ago
  mizusato 533e88d3fc rename cs to ss 2 years ago
  mizusato 3fb33ed9d6 cs root and stmt 2 years ago
  mizusato 8ba3e03069 adjust 2 years ago
  mizusato 5939f8f116 Merge remote-tracking branch 'origin/syntax22' into go118 2 years ago
  mizusato 49d0214234 fix syntax 2 years ago
  mizusato 0e09d67d86 adjust todos 2 years ago
  mizusato b26845935c adapter initial 2 years ago
  mizusato f63aacf53e cs expr and type 2 years ago
  mizusato 48f13a2470 Merge remote-tracking branch 'origin/syntax22' into go118 2 years ago
  mizusato da06fcc795 update todos 2 years ago
  mizusato 961c5034f8 move ast package 2 years ago
  mizusato 487c2cdeb5 fix 2 years ago
  mizusato 0a518f871a fix todo 2 years ago
  mizusato dbd4082cff lib vd add todos 2 years ago
  mizusato 2bc3694509 migrate vd 2 years ago
  mizusato 73d8d5b4c8 adjust 2 years ago
  mizusato 9dd73c57ad add todo 2 years ago
  mizusato fb9d87fa19 update todos 2 years ago
  mizusato ab43e61bcc adjust 2 years ago
  mizusato 8c420d100f adjust 2 years ago
  mizusato e115c7074b fix, migrate ast 2 years ago
  mizusato b9378d51b7 fix 2 years ago
  mizusato 07fcc4b727 adjust 2 years ago
  mizusato 105fd18744 adjust 2 years ago
  mizusato 199305224b no asset statement 2 years ago
  mizusato 4859082e59 restore change on todos 2 years ago
  mizusato 85adbdcd6e adjust 2 years ago
  mizusato bca96ddacb fix 2 years ago
  mizusato b03720a35f no restricted, data union 2 years ago
  mizusato 42d6ba89ba fix 2 years ago
  mizusato 2fc470a6a5 when, fix lambda 2 years ago
  mizusato 6984f7946a fix block and lambda 2 years ago
  mizusato cdfc7ca500 data record and service interface 2 years ago
  mizusato 9095d194d4 update todos 2 years ago
  mizusato 46aded2619 new syntax 2 years ago
  mizusato aee4426144 adjust todos 2 years ago
  mizusato 064049f565 adjust 2 years ago
  mizusato eea49092c0 add todos 2 years ago
  mizusato 670c8d7cb4 adjust todo 2 years ago
  mizusato 1255b57d15 adjust todo 2 years ago
  mizusato df9f93a226 add error for unsupported cast 2 years ago
  mizusato 9cb94a5de3 fix 2 years ago
  mizusato 3432e1b32f update todos 2 years ago
  mizusato fd344f7bfe rx prevent sync feedback 2 years ago
  mizusato 72e827fcf1 rename ui::Input 2 years ago
  mizusato 64399976aa adjust todo 2 years ago
  mizusato 971041efba add todo 2 years ago
  mizusato 2209e4b0a8 adjust todos 2 years ago
  mizusato 6dbb854739 adjust todos 2 years ago
  mizusato e04aa529d9 add todos 2 years ago
  mizusato dc2176f110 add todos 2 years ago
  mizusato 0001dba11f adjust, new ref test 2 years ago
  mizusato 7ddd6546a5 fix 2 years ago
  mizusato 40a7a8209b adjust todo 2 years ago
  mizusato 7c2941c7fc dynamic cast 2 years ago
  mizusato 90ae7627e9 adjust todos 2 years ago
  mizusato 9cad299dbe add todo 2 years ago

+ 7 - 0
.idea/dictionaries/mizus.xml

@@ -0,0 +1,7 @@
+<component name="ProjectDictionaryState">
+  <dictionary name="mizus">
+    <words>
+      <w>vals</w>
+    </words>
+  </dictionary>
+</component>

+ 7 - 0
.idea/dictionaries/mizusato.xml

@@ -15,6 +15,7 @@
       <w>bytelist</w>
       <w>centralwidget</w>
       <w>cmds</w>
+      <w>conds</w>
       <w>desugar</w>
       <w>desugared</w>
       <w>discardable</w>
@@ -22,10 +23,14 @@
       <w>dtor</w>
       <w>elif</w>
       <w>elifs</w>
+      <w>eventloop</w>
       <w>exprlist</w>
       <w>exprs</w>
       <w>extern</w>
       <w>fscanln</w>
+      <w>gctx</w>
+      <w>icrc</w>
+      <w>icrp</w>
       <w>inspectable</w>
       <w>ireg</w>
       <w>kmmm</w>
@@ -53,7 +58,9 @@
       <w>scanln</w>
       <w>sched</w>
       <w>sqrt</w>
+      <w>strlist</w>
       <w>typelist</w>
+      <w>ufcs</w>
       <w>unbox</w>
       <w>unboxes</w>
       <w>unpop</w>

+ 5 - 0
.idea/misc.xml

@@ -3,4 +3,9 @@
   <component name="JavaScriptSettings">
     <option name="languageLevel" value="ES6" />
   </component>
+  <component name="SwUserDefinedSpecifications">
+    <option name="specTypeByUrl">
+      <map />
+    </option>
+  </component>
 </project>

+ 0 - 15
.idea/runConfigurations/go_test_kumachan_interpreter_compiler_loader.xml

@@ -1,15 +0,0 @@
-<component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="go test kumachan/interpreter/compiler/loader" type="GoTestRunConfiguration" factoryName="Go Test" nameIsGenerated="true">
-    <module name="KumaChan" />
-    <working_directory value="$PROJECT_DIR$/interpreter/compiler/loader" />
-    <kind value="PACKAGE" />
-    <package value="kumachan/interpreter/compiler/loader" />
-    <directory value="$PROJECT_DIR$" />
-    <filePath value="$PROJECT_DIR$" />
-    <output_directory value="$PROJECT_DIR$/build" />
-    <framework value="gotest" />
-    <method v="2">
-      <option name="RunConfigurationTask" enabled="true" run_configuration_name="Dependencies" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
-    </method>
-  </configuration>
-</component>

+ 3 - 3
.idea/runConfigurations/go_test_kumachan_standalone_sss.xml

@@ -1,10 +1,10 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="go test kumachan/standalone/sss" type="GoTestRunConfiguration" factoryName="Go Test" nameIsGenerated="true">
+  <configuration default="false" name="go test kumachan/lang/textual" type="GoTestRunConfiguration" factoryName="Go Test" nameIsGenerated="true">
     <module name="KumaChan" />
-    <working_directory value="$PROJECT_DIR$/standalone/sss" />
+    <working_directory value="$PROJECT_DIR$/lang/textual" />
     <root_directory value="$PROJECT_DIR$" />
     <kind value="PACKAGE" />
-    <package value="kumachan/standalone/sss" />
+    <package value="kumachan/lang/textual" />
     <directory value="$PROJECT_DIR$" />
     <filePath value="$PROJECT_DIR$" />
     <output_directory value="$PROJECT_DIR$/build" />

+ 3 - 3
.idea/runConfigurations/go_test_kumachan_interpreter_runtime_rt.xml

@@ -1,10 +1,10 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="go test kumachan/interpreter/runtime/rt" type="GoTestRunConfiguration" factoryName="Go Test" nameIsGenerated="true">
+  <configuration default="false" name="go test kumachan/lang/textual/syntax" type="GoTestRunConfiguration" factoryName="Go Test" nameIsGenerated="true">
     <module name="KumaChan" />
-    <working_directory value="$PROJECT_DIR$/interpreter/runtime/rt" />
+    <working_directory value="$PROJECT_DIR$/lang/textual/syntax" />
     <root_directory value="$PROJECT_DIR$" />
     <kind value="PACKAGE" />
-    <package value="kumachan/interpreter/runtime/rt" />
+    <package value="kumachan/lang/textual/syntax" />
     <directory value="$PROJECT_DIR$" />
     <filePath value="$PROJECT_DIR$" />
     <output_directory value="$PROJECT_DIR$/build" />

+ 23 - 121
TODO

@@ -2,134 +2,36 @@ TODO
 
 ## Important
 
-encode, decode, decode*: async version
+repl gui (text browser + line edit, tab completion)
+    - QTextBrowser < QTextEdit::append
+    - display details of large objects in another window
+    - consider full debugger (multiple tabs, console + timeline + source + gui)
+    - debugger (in machine), debugger server, debugger client
+    - reflect::Type, (param T -> Unknown)
+    - reflect::Value (implicit cast from T to reflect::Value[T])
+    - debug::Log('state', state)
 
-type #XXX -> type XXX data
+ui api
+    - ui::modal-get-text
+    - api functions for file dialogs, font dialog, ...
+    - `interact-with-window` add option `min-size`; `popup` add option `rel-pos`
+    - context menu (QMenu.exec)
 
-SQLite (QSqlDatabase) project source storage (exclusive conn, diff the whole db)
+adjust
+    - qtbinding C side int vs. go side int (not the same type, fix it)
+    - var wait = make(chan struct{})  // encapsulate to something in util (SyncPair)
 
-module(can be private/public) < package
+## IDE
 
-UUID for each type/const/operator
-
-package: kvdb (-> gist)
-    content: modules(types,operators), entry point, dependencies, assets, docs
-
-ctor lambda -> generate default ctor (private) for protected/opaque type
-
-- ui::Input -> ui::TextInput
-- ui::TextView 2-way binding with Mutable[String] relay buffer (details on gist)
-- ListEdit: change mutating flag to relay buffer, similarly
-- Reactive: consider forbidding update(commit) during notification(notify)
-- ui::modal-get-text, ui::TextViewMultiLine, ui::InputMultiLine
-
-consider: type LiteralString protected String;
-
-dynamic cast (CaseRef[Interface,Concrete])
-
-`interact-with-window` add option `min-size`; `popup` add option `rel-pos`
-
-revise argument count limit (consider accessing elements in TupleValue directly)
-
-implicit context default values
-
-context menu (QMenu.exec)
-
-consider hook-based event handling
-
-var wait = make(chan struct{})  // encapsulate to something in util
-
-qtbinding C side int vs. go side int (not the same type, fix it)
-
-api functions for file dialogs, font dialog, ...
-
-loader cache: (file-path, modified-time) => AST/asset
-
-"map" operation for homogenous tuple
-
-typeList and functionList: consider sorting by date
-
-consider making `container` module standalone
-
-refactor code of container types after generics available
-
-
-## IDE Roadmap / Design
-
-CS: code structures
-
-code {
-    textual: code --parse--> CST --transform--> AST --adapt--> CS
-    structural: CS
-}
-
-file {
-    textual: 1 file, .rxt, package { mod1 { ... } mod2 { ... } }
-    structural: 1 file, .rx, sqlite database (kvdb)
-}
-
-module can be configured as 'no module prefix' (mod:: not displayed in IDE)
-
-- {prefix,infix,suffix,continuation} operator
-    prefix (function)
-    infix (operator)
-    suffix (method)
-    continuation (control)
-
-export 'b9adcfb3-7830-4092-9fd2-fc414172c774'
-function tick {interval: Number}: Source[unit] {
-    // code
-}
-export 'c4dfe913-35f5-46ee-bd46-232d778cffd4'
-method List.length: Number {
-    // code
-}
-export '89faeba7-e533-4f72-92db-93aab92c3a40'
-operator + (l: Integer, r: Integer): Integer {
-    // code
-}
-export '6e95ceb3-a479-4586-a788-ee9a2284ca1e'
-control await[A,B] (a: Async[A], k: &(A) => Async[B]): Async[B] {
-    // code
-}
-
-- Browser-like navigation (statement <=> page) (back, forward, recent history)
-
-- Tags for functions/types (tags instead of classes/folders)
-
-- { Type.method obj-subtype }
-
-- call function with explicit context passing { f(ctx{=:eq}) x }
-
-- no function ref, function -> operator
-
-- language-based debug-log (we can know the type)
-
-- sample input (to get a clear preview of the dataflow)
+browser-like navigation
+    - back, forward, recent history
 
+structural editing
+    - based on readonly QTextEdit
 
 ## Refinement
 
-- Code: dummy interface: consider { impl(Interface) } instead of { Interface() }
-
-- Code: AST node renaming
-
-- API: consider renaming wait and tick
-
-
-## Reflection
-
-type type[T] protected Type;
-type Type native;
-type value[T] protected Value;
-type Value native;
-|reflect::type[Foo]|
-|reflect::value| "abc"
-// type assertion etc. implemented by (native) functions
-
-
-## API Refactor
-
-- API: revise resource management for files, ... (consider Disposable[T] monad)
+revise resource management for files
+    - consider Disposable[T] (ctx-based disposal or persist closable object)
 
 

+ 181 - 0
interpreter/compiler/assign.go

@@ -0,0 +1,181 @@
+package compiler
+
+import (
+	"kumachan/lang/source"
+	"kumachan/lang/typsys"
+	"kumachan/interpreter/program"
+)
+
+
+func assign(expected typsys.Type, expr *program.Expr, ctx *exprContext, s0 *typsys.InferringState) (*program.Expr, *typsys.InferringState, *source.Error) {
+	var loc = expr.Info.Location
+	var t = expr.Type.Type
+	// direct
+	if ok, s1 := typsys.Match(expected, t, s0); ok {
+		return expr, s1, nil
+	}
+	// convert to interface
+	if I, Id, Ia, ok := getInterface(expected, ctx); ok {
+		var d, a, ok = getTypeDefArgs(t, ctx)
+		if !(ok) { goto NG }
+		if _, is_interface := d.Content.(typsys.Interface); is_interface {
+			// interface -> interface
+			var ok, s1 = typsys.MatchAll(Ia, a, s0)
+			if !(ok) { goto NG }
+			{ var It, ok = typsys.GetCertainOrInferred(expected, s1)
+			if !(ok) { goto NG }
+			if up, ok := getInterfacePath(d, Id, ctx, nil); ok {
+				var converted = &program.Expr {
+					Type:    It,
+					Info:    expr.Info,
+					Content: program.InterfaceTransformUpward {
+						Arg:  expr,
+						Path: up,
+					},
+				}
+				return converted, s1, nil
+			} else {
+				goto NG
+			} }
+		} else {
+			// concrete -> interface
+			var table, ok = ctx.resolveDispatchTable(d, Id)
+			if !(ok) {
+				if isSamInterface(I, Id) {
+					var field = I.FieldList[0]
+					var field_t = inflateFieldType(field, Id, Ia)
+					var ok, s1 = typsys.Match(field_t, t, s0)
+					if !(ok) { goto NG }
+					{ var It, ok = typsys.GetCertainOrInferred(expected, s1)
+					if !(ok) { goto NG }
+					var converted = &program.Expr {
+						Type: It,
+						Info: expr.Info,
+						Content: program.InterfaceFromSingleMethod {
+							MethodValue: expr,
+						},
+					}
+					return converted, s1, nil }
+				}
+				goto NG
+			}
+			{ var ok, s1 = typsys.MatchAll(Ia, a, s0)
+			if !(ok) { goto NG }
+			{ var It, ok = typsys.GetCertainOrInferred(expected, s1)
+			if !(ok) { goto NG }
+			var converted = &program.Expr {
+				Type:    It,
+				Info:    expr.Info,
+				Content: program.Interface {
+					ConcreteValue: expr,
+					DispatchTable: table,
+				},
+			}
+			return converted, s1, nil } }
+		}
+	}
+	// convert to union
+	if U, Ud, Ua, ok := getUnion(expected, ctx); ok {
+		var converted *program.Expr
+		var s2 *typsys.InferringState
+		var key string
+		var found = false
+		for i, field := range U.FieldList {
+			var index = uint(i)
+			var field_t = inflateFieldType(field, Ud, Ua)
+			var ok, s1 = typsys.Match(field_t, t, s0)
+			if ok {
+				var certain, ok = typsys.GetCertainOrInferred(expected, s1)
+				if ok {
+					if found {
+						var this_key = field.Name
+						return nil, nil, source.MakeError(loc,
+							E_AmbiguousAssignmentToUnion {
+								Union: Ud.Ref.String(),
+								Key1:  key,
+								Key2:  this_key,
+							})
+					}
+					found = true
+					key = field.Name
+					s2 = s1
+					converted = &program.Expr {
+						Type:    certain,
+						Info:    expr.Info,
+						Content: program.Union {
+							Index: int(index),
+							Value: expr,
+						},
+					}
+				}
+			}
+		}
+		if found {
+			return converted, s2, nil
+		} else {
+			goto NG
+		}
+	}
+	// convert to Int
+	if program.T_Int_(expected) {
+		if _, _, ok := getEnum(t, ctx); ok {
+			var converted = &program.Expr {
+				Type:    typsys.CertainType { Type: program.T_Int() },
+				Info:    expr.Info,
+				Content: program.EnumToInt { EnumValue: expr },
+			}
+			return converted, s0, nil
+		}
+	}
+	NG:
+	return nil, nil, source.MakeError(loc,
+		E_NotAssignable {
+			From: typsys.Describe(t),
+			To:   typsys.DescribeWithInferringState(expected, s0),
+		})
+}
+
+func getUnion(t typsys.Type, ctx *exprContext) (typsys.Union, *typsys.TypeDef, ([] typsys.Type), bool) {
+	var def, args, ok = getTypeDefArgs(t, ctx)
+	if !(ok) { goto NG }
+	{ var union, ok = def.Content.(typsys.Union)
+	if !(ok) { goto NG }
+	return union, def, args, true }
+	NG:
+	return typsys.Union {}, nil, nil, false
+}
+func getEnum(t typsys.Type, ctx *exprContext) (typsys.Enum, *typsys.TypeDef, bool) {
+	var def, _, ok = getTypeDefArgs(t, ctx)
+	if !(ok) { goto NG }
+	{ var enum, ok = def.Content.(typsys.Enum)
+	if !(ok) { goto NG }
+	return enum, def, true }
+	NG:
+	return typsys.Enum {}, nil, false
+}
+func getTypeDefArgs(t typsys.Type, ctx *exprContext) (*typsys.TypeDef, ([] typsys.Type), bool) {
+	if ref_type, ok := t.(typsys.RefType); ok {
+		var def = ctx.mustHaveType(ref_type.Def)
+		var args = ref_type.Args
+		return def, args, true
+	} else {
+		return nil, nil, false
+	}
+}
+func getInterfacePath(root *typsys.TypeDef, descendant *typsys.TypeDef, ctx *exprContext, base ([] int)) ([] int, bool) {
+	for i, child_ref := range root.Interfaces {
+		var child = ctx.mustHaveType(child_ref)
+		var current = append(base, i)
+		if child == descendant {
+			return current, true
+		} else {
+			var path, ok = getInterfacePath(child, descendant, ctx, current)
+			if ok {
+				return path, true
+			}
+		}
+	}
+	return nil, false
+}
+
+

+ 0 - 23
interpreter/compiler/checker/asset.go

@@ -1,23 +0,0 @@
-package checker
-
-type AssetProcessor struct {
-	MIME       string
-	Type       nominalType
-	Transform  func([] byte) ([] byte, error) // nullable
-}
-var assetProcessorsMap = map[string] AssetProcessor {
-	".png": {
-		MIME: "image/png",
-		Type: coreAssetPNG,
-	},
-	".css": {
-		MIME: "text/css",
-		Type: coreAssetCSS,
-	},
-	".ttf": {
-		MIME: "font/ttf",
-		Type: coreAssetTTF,
-	},
-}
-
-

+ 0 - 0
interpreter/compiler/checker/check.go


Some files were not shown because too many files changed in this diff