fmease / lushui

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

Replace literals with literal attributes with literals namespaced under type namespaces #125

Closed fmease closed 2 years ago

fmease commented 2 years ago

Remove the following attributes: @Int, @Int32, @Int64, @List, @Nat, @Nat32, @Nat64, @Rune, @Text and @Vector. And start parsing Path "." #Number-Literal, Path "." #Text-Literal and Path "." Sequence-Literal. To make this work, extend the relevant AST nodes with the field path: Option<Path>. Move number literal validation into the name resolver.

Examples

@Int64 34 becomes Int64.34 if Int64 is in scope or extern.core.int64.Int64.34 if not. @Text "Λ" becomes extern.core.text.Text."Λ" or Text."Λ". @Vector [2 4 10] becomes extern.core.vector.Vector.[2 4 10] or Vector.[2 4 10]. @Int32 -10 becomes Int32.-10 (…).

Addendum

Add sequence literal support for List, Vector and Tuple (should we remove Duple and Triple?) (blocker: type inference/implicit parameters!):

fmease commented 2 years ago

This means: the (Tuple List.[Nat Text Bool]) Tuple.[0 "B" true] or the (Tuple [Nat Text Bool]) [0 "B" true] with overloaded literals. ( [0 "B" true] : Tuple [Nat Text Bool] )