Skip to content

Commit

Permalink
Containers (#12)
Browse files Browse the repository at this point in the history
* Switch to 'turbofish' generics syntax and '['/']' for builtin container
delimiters
* Extend/modify type inference code to handle builtin containers
  • Loading branch information
andy-byers authored Jul 19, 2024
1 parent 0a8f670 commit ee861e7
Show file tree
Hide file tree
Showing 41 changed files with 3,650 additions and 2,655 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 ee861e7

Please sign in to comment.