Skip to content

Commit

Permalink
Switch to 'turbofish' generics syntax and '['/']' for builtin container
Browse files Browse the repository at this point in the history
delimiters
Use the unification code to infer types for builtin containers,
since they don't have a 'path' like other ADT literals.
  • Loading branch information
andy-byers committed Jul 13, 2024
1 parent 0a8f670 commit ff49dc2
Show file tree
Hide file tree
Showing 40 changed files with 3,259 additions and 2,322 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ target_sources(paw
${PAW_SOURCE_DIR}/unify.h
${PAW_SOURCE_DIR}/util.h
${PAW_SOURCE_DIR}/value.h
${PAW_SOURCE_DIR}/vector.h
PRIVATE ${PAW_SOURCE_DIR}/api.c
${PAW_SOURCE_DIR}/ast.c
${PAW_SOURCE_DIR}/auxlib.c
Expand Down
6 changes: 3 additions & 3 deletions GRAMMER.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Declaration = VarDecl | FunctionDecl | StructDecl |
EnumDecl | TypeDecl .
VarDecl = "let" name [":" Type] "=" Expr .
TypeDecl = "type" name [Generics] "=" Type .
Generics = "[" {name ","} name "]" .
Generics = "<" {name ","} name [","] ">" .
```

### Functions
Expand Down Expand Up @@ -110,8 +110,8 @@ Type = NamedType | TypeLit .
TypeLit = FuncType | VectorType | MapType |
TupleType | NamedType .
FuncType = "fn" "(" [TypeList] ")" ["->" Type] .
TypeList = {Type ","} Type .
TypeArgs = "[" TypeList "]" .
TypeList = {Type ","} Type [","] .
TypeArgs = "::" "<" TypeList ">" .
NamedType = name [TypeArgs] .
VectorType = "[" Type "]" .
MapType = "[" Type ":" Type "]" .
Expand Down
Loading

0 comments on commit ff49dc2

Please sign in to comment.