diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-11-07 13:09:44 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-11-07 13:09:44 +0200 |
| commit | 8dce541c96a329e3b12f3ea3794fcc8202fbd134 (patch) | |
| tree | 0b086b998c9d392242acba0a7518fa3d535b1c56 /hmm.t | |
| parent | bb560b4201d8b813ed3999250845f365ff9d6c50 (diff) | |
| download | ek-8dce541c96a329e3b12f3ea3794fcc8202fbd134.tar.gz ek-8dce541c96a329e3b12f3ea3794fcc8202fbd134.zip | |
simplift syntax somewhat
+ Explicit macro expansion
+ Still have to simplify AST and type stuff, probably worth rewriting or
something
Diffstat (limited to 'hmm.t')
| -rw-r--r-- | hmm.t | 54 |
1 files changed, 54 insertions, 0 deletions
@@ -0,0 +1,54 @@ +/* common.ek */ +typedef any {} + +/* vec.ek */ +typedef vec { + i27 size; + i27 cap; + *any buf; +} + +insert(*vec v, i27 i, typeof(*v.buf) e) +{ + ... +} + +/* define local vector type */ +define vec!(t) +{ + struct vec [vec] {*t buf;} +} + +/* map.ek */ +typedef hashable { + /* pointers? */ + i27 hash(hashable); +} + +typedef map { + i27 size; + i27 cap; + *hashable keys; + *any values; +} + +// vs. append(*map h, typeof h.keys[0] k, typeof h.values[0] e) +// vs. append(*map h, ?h.keys[0] k, ?h.values[0] e) +// vs. append(*map h, #h.keys[0] k, #h.values[0] e) +// vs. append(*map h, :h.keys[0] k, :h.values[0] e) +// vs something else, hmm +append(*map h, `h.keys[0] k, `h.values[0] e) +{ + ... +} + +/* main.ek */ +main() +{ + vec!(i27) v; + // should automatically find the correct insert (unless the same + // elements as the vec typedef are used somewhere else) + insert(v, 0, 20); + // otherwise, force search as vec? + insert(v as vec, 0, 20); +} |
