fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
7 stars 0 forks source link

Initial implementation of sequence literals #171

Closed fmease closed 1 year ago

fmease commented 1 year ago

First of all, refactor the implementation of known & intrinsic bindings (thus this supersedes #138 and fixes #39).

Then, add initial support for sequence literals for List, Vector & Tuple. Since we don't support implicit arguments yet, the element type sadly has to be manually supplied for the time being. Quite uglily, for lists & vectors we assume the first “element” is the element type and for tuples we assume that every “element” at even indices is an element type. Meaning, for lists & vectors instead of e.g. S.[], you need to write S.[E] (where E is the element type of sequence S) and instead of e.g. S.[x y], you need to write S.[E x y]. For tuples, you need to write e.g. Tuple.[E x F y] instead of Tuple.[x y]. Just for readability, I am going to parenthesize the element type until we implement those literals correctly (e.g. S.[(E) x y]).