diff --git a/.gitattributes b/.gitattributes index 558347fa..3694376a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -*.void linguist-language=Swift +*.voyd linguist-language=Swift diff --git a/.gitignore b/.gitignore index 3c33de80..e0d77700 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ ast.json *output*.json *output*.wat .env -test.void +test.voyd /playground.* /playground diff --git a/.vscode/settings.json b/.vscode/settings.json index 8068d23c..e1b70d4e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -47,7 +47,7 @@ "cSpell.advanced.feature.useReferenceProviderWithRename": true, "cSpell.advanced.feature.useReferenceProviderRemove": "/^#+\\s/" }, - "[void]": { + "[voyd]": { "editor.tabSize": 2 }, "vitest.nodeExecutable": "" diff --git a/README.md b/README.md index 557d0c13..8c7b91ab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Void +# Voyd -Void is a high performance WebAssembly language with an emphasis on full stack web development. +Voyd is a high performance WebAssembly language with an emphasis on full stack web development. https://justforfunnoreally.dev/ @@ -29,7 +29,7 @@ fn app() -> JSX::Element **Disclaimer** -Void is in it's very early stages of development. Void is not ready for public +Voyd is in it's very early stages of development. Voyd is not ready for public announcement or use. Some core syntax and semantics are subject to change. Expect frequent breaking changes. In addition, many documented features are not yet implemented. @@ -60,13 +60,13 @@ yet implemented. **Install** ``` -npm i -g voidc +npm i -g voydc ``` **Usage** ``` -voidc path/to/code.void +voydc path/to/code.voyd ``` **Requirements** @@ -130,7 +130,7 @@ To call a function, use the function name followed by the arguments in parenthes add(1, 2) ``` -Void also supports uniform function call syntax (UFCS), allowing functions to be called on a type as if they were methods of that type. +Voyd also supports uniform function call syntax (UFCS), allowing functions to be called on a type as if they were methods of that type. ```rust 1.add(2) diff --git a/docs/README.md b/docs/README.md index 6cb4e553..30be7707 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,3 +1,3 @@ -# Void Language Maintainer Docs +# Voyd Language Maintainer Docs -Docs intended for maintainers of the void language +Docs intended for maintainers of the voyd language diff --git a/docs/notes/devlog.md b/docs/notes/devlog.md index 8b2a1161..7afce78e 100644 --- a/docs/notes/devlog.md +++ b/docs/notes/devlog.md @@ -46,7 +46,7 @@ brought to the fact that a function is an effect? Background, given: ``` -// src/throws.void +// src/throws.voyd effect State ctl set(val: T) -> T ctl get() -> T @@ -131,7 +131,7 @@ Effect system implementation ideas: ```ts type Get = () => number; -type Put = (value: number) => void; +type Put = (value: number) => voyd; const loop = (n: number) => { if (n === 0) return; @@ -148,7 +148,7 @@ const put = (value, state, continuation) => const loop2 = ( n: number, state: { value: number }, - continuation: (state: { value: number }) => void + continuation: (state: { value: number }) => voyd ) => { if (n === 0) return continuation(state, undefined); @@ -182,11 +182,11 @@ Ideal features: - Supports ES Module Syntax natively? - Handles function overloads cleanly - Still easily supports WASM and potentially other sources while still providing a good DX -- A `module.void` format for configuration and exports etc +- A `module.voyd` format for configuration and exports etc Open questions: -- Void supports _both_ named parameters _and_ objects and treats each one differently. How should +- Voyd supports _both_ named parameters _and_ objects and treats each one differently. How should this be handled? The best I can think of is that named parameters should be treated as objects - Need to define a standard for tagged data structures. @@ -197,7 +197,7 @@ Open questions: 1. (Unchanged) Any line with more than one symbol is wrapped with parenthesis (if it does not already have them) - ```void + ```voyd add 1 2 // Becomes @@ -211,7 +211,7 @@ Open questions: 2. The first child is not a named argument 3. The parent is not wrapped in parenthesis - ```void + ```voyd add 2 mul 4 x diff --git a/docs/notes/language-benefits.md b/docs/notes/language-benefits.md index 7fc1fedd..18b51772 100644 --- a/docs/notes/language-benefits.md +++ b/docs/notes/language-benefits.md @@ -74,5 +74,5 @@ export class Parameter extends NamedEntity { } ``` -Void avoids this common error as the constructor / init function +Voyd avoyds this common error as the constructor / init function is not defined by the user. This problem still exists on overloaded initializers diff --git a/docs/structural-subtyping.md b/docs/structural-subtyping.md index 491c53e5..1ce31e9a 100644 --- a/docs/structural-subtyping.md +++ b/docs/structural-subtyping.md @@ -1,6 +1,6 @@ Context: -```void +```voyd obj A { x: i32 } @@ -24,7 +24,7 @@ fn main() -> i32 ``` Implementation (Psuedo VOID / WASM hybrid): -```void +```voyd // All objects implicitly extend Object type Object = { // All objects that can be used to access a member of an the object. diff --git a/example.void b/example.voyd similarity index 100% rename from example.void rename to example.voyd diff --git a/package-lock.json b/package-lock.json index 1da55a72..689d47d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "voidc", + "name": "voydc", "version": "0.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "voidc", + "name": "voydc", "version": "0.6.0", "license": "ISC", "dependencies": { @@ -17,8 +17,8 @@ "uniqid": "^5.2.0" }, "bin": { - "void": "dist/cli/cli.js", - "voidc": "dist/cli/cli.js", + "voyd": "dist/cli/cli.js", + "voydc": "dist/cli/cli.js", "vt": "src/cli/cli-dev.ts" }, "devDependencies": { diff --git a/package.json b/package.json index 3838f708..0ae6372c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "voidc", + "name": "voyd", "version": "0.6.0", "description": "", "module": "dist/index.js", @@ -13,8 +13,7 @@ "prepublishOnly": "tsc" }, "bin": { - "voidc": "./dist/cli/cli.js", - "void": "./dist/cli/cli.js", + "voyd": "./dist/cli/cli.js", "vt": "./src/cli/cli-dev.ts" }, "keywords": [], diff --git a/reference/basics.md b/reference/basics.md index e059e66f..cfef9ff6 100644 --- a/reference/basics.md +++ b/reference/basics.md @@ -1,6 +1,6 @@ # Comments -```void +```voyd // This is a single line comment ``` # Identifiers @@ -8,7 +8,7 @@ Identifiers bind names to values, types, and other language constructs. They can contain letters, numbers, and underscores, and must start with a letter or underscore. -```void +```voyd hey hey_there MyType @@ -17,7 +17,7 @@ MyType2 # Variables -```void +```voyd // Declare an immutable variable let x = 5 @@ -27,7 +27,7 @@ var y = 3 # String Literals -```void +```voyd // Strings are defined with double quotes let name = "John" @@ -42,7 +42,7 @@ let greeting = "Hello, ${name}" # Numeric Literals -```void +```voyd // Integers let x = 5 @@ -52,14 +52,14 @@ let y = 3.14 # Boolean Literals -```void +```voyd let x = true let y = false ``` # Object literals -```void +```voyd let value = { a: 5, b: 4 @@ -70,7 +70,7 @@ let x = value.a // x will be bound to 5 Field shorthand: -```void +```voyd let a = 5 let value = { a, b: 4 } @@ -80,7 +80,7 @@ let value = { a: a, b: 4 } # Tuple literals -```void +```voyd let value = (5, 4) let x = value.0 // x will be bound to 5 @@ -90,7 +90,7 @@ let (a, b) = value # Control Flow -```void +```voyd // If statements if x > 5 then: // Do something @@ -130,7 +130,7 @@ let y = Expressions are statements that return a value. They can be used in a variety of contexts, such as variable assignment, function arguments, and more. -```void +```voyd // Binary expressions let x = 5 + 3 @@ -138,9 +138,9 @@ let x = 5 + 3 let y = add(5, 3) ``` -Virtually every statement in Void is an expression, including control flow statements. +Virtually every statement in Voyd is an expression, including control flow statements. -```void +```voyd let x = if true then: 1 else: 2 // Blocks are also expressions, returning the result of the last statement diff --git a/reference/control-flow.md b/reference/control-flow.md index e7a68224..8173bbef 100644 --- a/reference/control-flow.md +++ b/reference/control-flow.md @@ -12,7 +12,7 @@ fn match(val: T, bind_identifier: Identifier, body: MatchBl ``` Example: -```void +```voyd obj Optional obj None extends Optional @@ -37,7 +37,7 @@ fn main(a: i32, b: i32) -> String The second signature of match is useful when the value being matched against is not already bound to an identifier (i.e. dot pipelines): -```void +```voyd fn main(a: i32, b: i32) -> String a.divide(b) .match(x) // Here, match binds the result of the previous expression to x diff --git a/reference/functions.md b/reference/functions.md index 3863ef6a..a489fa5c 100644 --- a/reference/functions.md +++ b/reference/functions.md @@ -2,7 +2,7 @@ ## Function Basics -```void +```voyd fn add(a: i32, b: i32) -> i32 a + b @@ -15,14 +15,14 @@ add(1, 2) With return type inference: -```void +```voyd // Equal sign is used when the function is written on one line fn add(a: i32, b: i32) = a + b ``` With effects: -```void +```voyd fn get_json(address: String): Async -> Dictionary let json_text = await fetch(address) parse_json(json_text) @@ -86,7 +86,7 @@ move(x: x, y: y, z: z) Labeled arguments also support concise closure sugar on call sites: -```void +```voyd fn try({ do: ((): throws -> void), catch: (e: Error) -> void }) try do(): @@ -218,9 +218,9 @@ See the chapter on [Syntax](./syntax.md) for more information and detailed rules ## Function Overloading -Void functions can be overloaded. Provided that function overload can be unambiguously distinguished via their parameters and return type. +Voyd functions can be overloaded. Provided that function overload can be unambiguously distinguished via their parameters and return type. -```void +```voyd fn sum(a: i32, b: i32) print("Def 1") a + b @@ -236,7 +236,7 @@ sum { a: 1, b: 2 } // Def 2 This can be especially useful for overloading operators to support a custom type: -```void +```voyd fn '+'(a: Vec3, b: Vec3) -> Vec3 Vec3(a.x + b.x, a.y + b.y, a.z + b.z) @@ -247,7 +247,7 @@ A function call is considered to be ambiguous when multiple functions in the same scope share the same name, and the types of each parameter overlap in order. -```void +```voyd fn add(a: i32, b: i32) -> i32 fn add(d: i32, e: i32) -> i32 // Ambiguous collision fn add(f: i32, c: f32) -> i32 // This is fine, the second parameter does not overlap with previous @@ -255,7 +255,7 @@ fn add(f: i32, c: f32) -> i32 // This is fine, the second parameter does not ove Object types overlap if one is an extension of the other: -```void +```voyd obj Animal {} obj Dog extends Animal {} obj Cat extends Animal {} diff --git a/reference/macros.md b/reference/macros.md index 045ae373..5e1a8dfe 100644 --- a/reference/macros.md +++ b/reference/macros.md @@ -1,6 +1,6 @@ # Macros -There are three types of macros in void, reader macros, regular macros, and +There are three types of macros in voyd, reader macros, regular macros, and syntax macros. All macros are expected to return a syntax object. Reader macros are used to transform the source code while it is being parsed. @@ -21,7 +21,7 @@ expression it prefixes. The `@` acts as the `,@` in common lisp and splices the list into the current list. Note that these shortcuts only apply to `macro`, `define-macro` uses the standard operators of common lisp (`,`, `,@`, etc). -```void +```voyd macro def-wasm-operator(op wasm-fn arg-type return-type) defun $op(left:$arg-type right:$arg-type) -> $return-type binaryen-mod ($arg-type $wasm-fn) (left right) @@ -48,7 +48,7 @@ backtick. > of nested backquote plus some examples. > https://lisp-journey.gitlab.io/blog/common-lisp-macros-by-example-tutorial/ -Void follows the suggestion of this website and pairs commas with the outermost +Voyd follows the suggestion of this website and pairs commas with the outermost backquote. Which allows one to use a backquote where a quote would normally be needed. @@ -101,7 +101,7 @@ must strictly adhere to the core language specification. Syntax Macro Pipeline Example: -```void +```voyd fn fib(n:i32) -> i32 if (n < 2) then: n @@ -128,7 +128,7 @@ fn (fib n:i32) -> i32 ## The Macro Pipeline -In the spirit of lisp, Void language is designed to be hackable. As a result, +In the spirit of lisp, Voyd language is designed to be hackable. As a result, the surface language syntax is implemented entirely in macros. This makes the language both easy to maintain, and easy to extend. @@ -139,5 +139,5 @@ There are three types of macros: and produce the final ast - Regular Macros: Expanded by a syntax macro -At a high level, the pipeline looks something like this: `file.void -> parser + +At a high level, the pipeline looks something like this: `file.voyd -> parser + reader macros -> syntax macros -> ast (the core language)` diff --git a/reference/memory.md b/reference/memory.md index 2bbb1f1b..e6526071 100644 --- a/reference/memory.md +++ b/reference/memory.md @@ -56,7 +56,7 @@ fn main() Mutable references can only be made to object types: -```void +```voyd // Error cannot borrow primitive type as mutable fn bump(x: &i32) -> i32 x += 1 diff --git a/reference/modules.md b/reference/modules.md index 2788e855..c77b4ed2 100644 --- a/reference/modules.md +++ b/reference/modules.md @@ -1,22 +1,22 @@ # Modules -Void uses a module system that borrows heavily from Rust's module semantics. +Voyd uses a module system that borrows heavily from Rust's module semantics. ## Defining Modules -In void modules are defined using files and folders, folders being +In voyd modules are defined using files and folders, folders being the parent module of their files. **From a file:** -```void -// src/internal.void +```voyd +// src/internal.voyd pub fn hey() "hey" ``` -```void -// src/main.void +```voyd +// src/main.voyd // Bring internal module into scope with a use import use internal @@ -26,22 +26,22 @@ internal::hey() **From a directory:** -```void -// cd src/internal/hey.void +```voyd +// cd src/internal/hey.voyd pub fn hey() "hey" -// cd src/internal/mod.void +// cd src/internal/mod.voyd pub mod hey::hey // export the hey function from the hey module index (mod) file -// Alternatively, you can define a void file that shares a name +// Alternatively, you can define a voyd file that shares a name // with the directory. -// cd src/internal.void +// cd src/internal.voyd pub mod hey::hey -// cd src/main.void +// cd src/main.voyd use src::internal internal::hey() @@ -51,8 +51,8 @@ Modules can also be defined within a file using the `mod` keyword. **With the mod keyword:** -```void -// src/main.void +```voyd +// src/main.voyd mod internal pub fn hey() @@ -65,7 +65,7 @@ internal::hey() The `use` is used to bring other modules and their children into scope. -```void +```voyd use my_module my_module::hey() @@ -89,7 +89,7 @@ use my_module::{ self as a_diff_name } // Import all exports from my_module use my_module::all -// Import the module named logger from the source code root at src/logger.void +// Import the module named logger from the source code root at src/logger.voyd use src::logger // Import log from the standard library @@ -100,15 +100,15 @@ Module paths work like directories, except `./` can be omitted, and instead of `../`, the folder name is directly used I.E. -```void -// src/utils/hello/world.void <- You are here -// src/utils/goodbye/jupiter.void <- We want to import this +```voyd +// src/utils/hello/world.voyd <- You are here +// src/utils/goodbye/jupiter.voyd <- We want to import this use utils::goodbye::jupiter ``` Here are more examples of valid and invalid imports given a module hierarchy -```void +```voyd mod src mod utils mod vec @@ -158,7 +158,7 @@ Module commands Path keywords: - `all` Bring everything exported by the preceding module into scope - `self` refers to the module itself, used to bring the module into scope as well as some of its children in the same call -- `std` The void standard library +- `std` The voyd standard library - `src` The source root - `pkg` Module containing installed packages @@ -167,8 +167,8 @@ Note: A module cannot have a keyword for a name # Exporting from a module -```void -// src/mod.void +```voyd +// src/mod.voyd // Export everything from the math file module pub mod math::all diff --git a/reference/mutability.md b/reference/mutability.md index 11043750..74c8d2ff 100644 --- a/reference/mutability.md +++ b/reference/mutability.md @@ -1,4 +1,4 @@ -# Mutability In Void +# Mutability In Voyd ## Variable Mutability diff --git a/reference/spec/README.md b/reference/spec/README.md index c9c224a6..7fe55c17 100644 --- a/reference/spec/README.md +++ b/reference/spec/README.md @@ -1,6 +1,6 @@ -# Void Language Spec +# Voyd Language Spec -This is the official specification for the Void Language. It is intended to be a +This is the official specification for the Voyd Language. It is intended to be a comprehensive but is currently a work in progress. The eventual goal is to have a complete and accurate specification for the @@ -9,7 +9,7 @@ alternative implementations to be written from it. **Audience** -This spec is primary as a reference for Void Language developers. Though it may +This spec is primary as a reference for Voyd Language developers. Though it may be useful for users of the language as well, especially those writing libraries and working with macros. @@ -18,6 +18,6 @@ and working with macros. This specification is broken down into two main parts: - [The Surface Language Specification](./surface.md) (What users write and know - as the Void language) + as the Voyd language) - [The Core Language Specification](./core.md) (What macros expand into, resembles the structure the compiler works with directly) diff --git a/reference/spec/core.md b/reference/spec/core.md index 73bfa630..0722a8e6 100644 --- a/reference/spec/core.md +++ b/reference/spec/core.md @@ -1,6 +1,6 @@ # The Core Language Specification -This specification defines the language targeted by the surface language. After all macros have been evaluated, void source files are transformed into a form compliant with this spec. +This specification defines the language targeted by the surface language. After all macros have been evaluated, voyd source files are transformed into a form compliant with this spec. NOTE: MAY BE OUT OF DATE. DO NOT RELY ON THIS YET. diff --git a/reference/spec/surface.md b/reference/spec/surface.md index 70a77db2..501f9ba9 100644 --- a/reference/spec/surface.md +++ b/reference/spec/surface.md @@ -1,6 +1,6 @@ # The Surface Language Specification -This specification defines the language users write, the "surface" void +This specification defines the language users write, the "surface" voyd language. This surface language spec includes: @@ -65,7 +65,7 @@ AnyChar = ? all valid characters (including whitespace) ?; ## The Syntax Pipeline -In the spirit of lisp, Void language is designed to be hackable. As a result, +In the spirit of lisp, Voyd language is designed to be hackable. As a result, the surface language syntax is implemented entirely in macros. This makes the language both easy to maintain, and easy to extend. @@ -76,14 +76,14 @@ There are three types of macros: and produce the final ast - Regular Macros: Expanded by a syntax macro -At a high level, the pipeline looks something like this: `file.void -> parser + +At a high level, the pipeline looks something like this: `file.voyd -> parser + reader macros -> syntax macros -> ast (the core language)` In the next sections, the different macros will be defined in depth. # Examples -```void +```voyd // Translated version of a swift example from https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency/ let photos = await taskGroup(of: Optional(Data).self) | () => diff --git a/reference/style-guide.md b/reference/style-guide.md index 0b21f1b3..36a57f71 100644 --- a/reference/style-guide.md +++ b/reference/style-guide.md @@ -1,4 +1,4 @@ -# Void Style Guide +# Voyd Style Guide ## Naming diff --git a/reference/syntax.md b/reference/syntax.md index c743475b..7e07f439 100644 --- a/reference/syntax.md +++ b/reference/syntax.md @@ -21,9 +21,9 @@ Expression # Parenthetical Elision -Void language is built around an s-expression syntax, like lisp: +Voyd language is built around an s-expression syntax, like lisp: -```void +```voyd (if (n < 2) (: then n) (: else (+ (fib (- n 1)) (fib (- n 2))))) @@ -32,7 +32,7 @@ Void language is built around an s-expression syntax, like lisp: To reduce visual noise, parenthesis can be elided, using tabs as a mechanism to infer where the parenthesis should be inserted: -```void +```voyd if (n < 2) then: n else: (+ (fib (- n 1)) (fib (- n 2))) @@ -44,7 +44,7 @@ This feature is inspired by [Scheme sweet-expressions](https://srfi.schemers.org 1. Any line with more than one symbol is wrapped in parenthesis. - ```void + ```voyd add 1 2 // Becomes @@ -54,7 +54,7 @@ This feature is inspired by [Scheme sweet-expressions](https://srfi.schemers.org 2. Indented lines are grouped together in a block and passed to their parent function call, provided the fist line is not a named argument. - ```void + ```voyd add 2 let x = 5 mul 4 x @@ -140,7 +140,7 @@ This feature is inspired by [Scheme sweet-expressions](https://srfi.schemers.org 5. Arguments already wrapped in parenthesis must be separated by a comma - ```void + ```voyd add(1, 2) // Becomes @@ -213,8 +213,8 @@ let x = my_func( # Standard Function Call Syntax -To make Void language feel more familiar to users familiar with C style -languages, Void supports standard function call syntax of the form `f(x)`. +To make Voyd language feel more familiar to users familiar with C style +languages, Voyd supports standard function call syntax of the form `f(x)`. ## Rules @@ -289,7 +289,7 @@ catch(e): # Infix Notation -Void supports infix notation using a predefined set of infix operators. +Voyd supports infix notation using a predefined set of infix operators. Operators, their precedence, and associativity (in typescript): diff --git a/reference/types/effects.md b/reference/types/effects.md index 5b52a235..ede1445c 100644 --- a/reference/types/effects.md +++ b/reference/types/effects.md @@ -10,9 +10,9 @@ Effects provide a number benefits to the language, library authors, and users: - Delimited continuations - And more! -Effects are a powerful language abstraction. They allow for features like async/await, exceptions, generators, and coroutines to be implemented **IN THE LANGUAGE**, rather than the implementation. Many features that are traditionally implemented in the compiler can be implemented as libraries in Void. This allows for more flexibility and control over the behavior of these features. It also saves users from having to wait for the language to be updated to get new features. No more waiting on endless bikeshedding discussions about the syntax of async/await! +Effects are a powerful language abstraction. They allow for features like async/await, exceptions, generators, and coroutines to be implemented **IN THE LANGUAGE**, rather than the implementation. Many features that are traditionally implemented in the compiler can be implemented as libraries in Voyd. This allows for more flexibility and control over the behavior of these features. It also saves users from having to wait for the language to be updated to get new features. No more waiting on endless bikeshedding discussions about the syntax of async/await! -Void's effect system takes heavy inspiration from: +Voyd's effect system takes heavy inspiration from: - [Koka Language](https://koka-lang.github.io), which largely inspired the effects syntax - [Effeckt Language](https://effekt-lang.org/) - The paper ["Structured Asynchrony with Algebraic Effects" by Daan Leijen"](https://www.microsoft.com/en-us/research/wp-content/uploads/2017/05/asynceffects-msr-tr-2017-21.pdf) diff --git a/reference/types/intersections.md b/reference/types/intersections.md index e59618ca..c83fc4f1 100644 --- a/reference/types/intersections.md +++ b/reference/types/intersections.md @@ -1,6 +1,6 @@ # Intersections -Void uses intersection types to combine the fields of multiple objects into a +Voyd uses intersection types to combine the fields of multiple objects into a single type. An intersection type is defined by listing the types it is composed of separated @@ -58,7 +58,7 @@ type AnimalWithLives = Animal & { let newt: Cat = Animal { name: "Whiskers" } & { lives: 3 } -// An implicit AnimalWithLives initializer is also available, to avoid writing out the & +// An implicit AnimalWithLives initializer is also available, to avoyd writing out the & let newt = AnimalWithLives { name: "Whiskers", lives: 3 } // We can define a new compatible nominal object diff --git a/reference/types/objects.md b/reference/types/objects.md index e089d1df..f0172e60 100644 --- a/reference/types/objects.md +++ b/reference/types/objects.md @@ -5,7 +5,7 @@ pairs (fields). They are defined by listing their fields between curly braces `{}`. -```void +```voyd type MyObject = { a: i32, b: i32 @@ -17,7 +17,7 @@ type MyObject = { An object is initialized using object literal syntax. Listing the fields and their corresponding values between curly braces `{}`. -```void +```voyd let my_object: MyObject = { a: 5, b: 4 @@ -26,7 +26,7 @@ let my_object: MyObject = { Field shorthand: -```void +```voyd // When a variable has the same name as a field; let a = 5 // The field can be omitted @@ -35,7 +35,7 @@ let value = { a, b: 4 } Spread operator: -```void +```voyd type MyObject2 = { a: i32, b: i32, @@ -52,7 +52,7 @@ let value2: MyObject2 = { ...value, c: 3 } The objects we have defined so far were all structural types. That is, they were satisfied by any object that had the same fields: -```void +```voyd type Animal = { name: string } @@ -69,7 +69,7 @@ explicitly defined to satisfy it. This is called a nominal type. For example: -```void +```voyd type BaseballPlayer = { has_bat: bool } @@ -95,7 +95,7 @@ cave to hit a ball. to alleviate this, we can define a nominal subtype of `Object`: -```void +```voyd obj BaseballPlayer { has_bat: bool } @@ -118,7 +118,7 @@ While a nominal object can satisfy a structural type with the same fields, the reverse is not true. A nominal object can only be used where the type it extends is expected. -```void +```voyd obj Animal { name: String } @@ -156,7 +156,7 @@ pet_structural(Cat { name: "Whiskers", lives_remaining: 9 }) Nominal objects have a default initializer that takes the fields of the object as arguments. -```void +```voyd obj Animal { id: i32 name: String @@ -168,7 +168,7 @@ let me = Animal { name: "John", id: 1 } You can add a custom initializer by defining a function with the same name as the object that accepts different arguments. -```void +```voyd obj Animal { id: i32 name: String @@ -182,7 +182,7 @@ fn Animal({ name: String }) -> Animal Methods can be defined on nominal objects using the `impl` keyword. -```void +```voyd obj Animal { name: String } @@ -206,7 +206,7 @@ log me.run // "John is running!" Unlike other languages, objects do not inherit methods from their parent type by default. Instead, they must be opted in with use statements: -```void +```voyd obj Dog extends Animal {} impl Dog @@ -218,13 +218,13 @@ fn main() ``` -Void uses static dispatch for all methods defined on a type. That is, when +Voyd uses static dispatch for all methods defined on a type. That is, when a function is called on a method, the function is determined at compile time. In practice, this means that compiler will pick the method on the declared type, even if a subtype is passed. For example: -```void +```voyd obj Animal {} obj Dog extends Animal {} @@ -253,7 +253,7 @@ using the methods of a subtype. ## Object Type Narrowing -```void +```voyd obj Optional obj None extends Optional @@ -281,7 +281,7 @@ fn main(a: i32, b: i32) Objects can be defined as final, meaning they cannot be extended. -```void +```voyd final obj Animal { name: String } @@ -301,7 +301,7 @@ grow and shrink in size when defined as a mutable variable. Type: `String` -```void +```voyd let my_string = String() // String literals are of type `String` @@ -314,7 +314,7 @@ Arrays are a growable sequence of values of the same type. Type: `Array` -```void +```voyd let my_array = Array(1, 2, 3) ``` @@ -324,6 +324,6 @@ Dictionaries are a growable collection of key-value pairs. Type: `Map` -```void +```voyd let my_dict = Dict { a: 1, b: 2, c: 3 } ``` diff --git a/reference/types/overview.md b/reference/types/overview.md index 9feab60e..7e283c3a 100644 --- a/reference/types/overview.md +++ b/reference/types/overview.md @@ -1,6 +1,6 @@ # Types Overview -The Void type system is structural at its core and supports nominal types +The Voyd type system is structural at its core and supports nominal types through the use of objects and traits. - [Types Overview](#types-overview) @@ -16,7 +16,7 @@ A type comes in a few categories: implemented by a type - `Effect` - Types that represent side effects a function can have -All but effect types in Void are first class, that is they can be passed as +All but effect types in Voyd are first class, that is they can be passed as arguments to functions, returned from functions, and assigned to variables. # Defining Types @@ -26,7 +26,7 @@ an equal sign, and a type expression representing how the type is satisfied. The most basic type definition is an alias for another type: -```void +```voyd type Name = String ``` @@ -44,7 +44,7 @@ ownership which are detailed in the memory chapter. ## Primitive Data Types -Primitive data types are the most basic data types in Void. They are value types +Primitive data types are the most basic data types in Voyd. They are value types that act as the building blocks for more complex data types. They include: @@ -57,7 +57,7 @@ They include: - `v128` - 128 bit SIMD vector - `bool` - Boolean (technically an i32 considered to be false when 0 and true when non-zero) -- `void` - The absence of a value +- `voyd` - The absence of a value TODO: Add more information about each of these types. diff --git a/reference/types/structs.md b/reference/types/structs.md index 70ff9269..475767ea 100644 --- a/reference/types/structs.md +++ b/reference/types/structs.md @@ -9,7 +9,7 @@ variable. And they are stored on the stack. They are defined by listing their fields between curly braces prefixed with the percent sign `%{}`. -```void +```voyd type MyStruct = %{ a: i32, b: i32 @@ -25,7 +25,7 @@ Tuple structs are a fixed sequence of values of different types. They are defined by listing their types between square braces prefixed with the percent sign `%()`. -```void +```voyd type MyTupleStruct = %(i32, bool) let my_tuple_struct: MyTupleStruct = %(1, true) @@ -36,7 +36,7 @@ let x = my_tuple_struct.0 They are effectively syntactic sugar for a struct with incrementing integer keys. -```void +```voyd type MyTupleStruct = %(i32, bool) // Resolves to diff --git a/reference/types/traits.md b/reference/types/traits.md index f5826817..172717c0 100644 --- a/reference/types/traits.md +++ b/reference/types/traits.md @@ -2,7 +2,7 @@ Traits are first class types that define the behavior of a nominal object. -```void +```voyd trait Run fn run(self) -> String fn stop(&self) -> void @@ -39,7 +39,7 @@ Status: Not yet implemented Traits can specify default implementations which are automatically applied on implementation, but may still be overridden by that impl if desired -```void +```voyd trait One fn one() -> i32 1 @@ -51,7 +51,7 @@ Status: Not yet implemented Traits can specify that implementors must also implement other traits: -```void +```voyd trait DoWork requires: This & That ``` @@ -61,7 +61,7 @@ Traits must be in scope to be used. If the `Run` trait were defined in a different file (or module), it would have to be imported before its methods could be used -```void +```voyd car.run() // Error, no function found for run use other_file::{ Run } @@ -71,7 +71,7 @@ car.run() // Vroom! Trait implementations cannot have overlapping target types: -```void +```voyd obj Animal {} obj Dog {} diff --git a/reference/types/tuples.md b/reference/types/tuples.md index 130156e5..dd8ed45f 100644 --- a/reference/types/tuples.md +++ b/reference/types/tuples.md @@ -2,7 +2,7 @@ Tuples are a fixed sequence of values of different types. -```void +```voyd type MyTuple = (i32, String, bool) let my_tuple: MyTuple = (1, "hello", true) diff --git a/reference/types/unions.md b/reference/types/unions.md index f83a64fa..82f4973c 100644 --- a/reference/types/unions.md +++ b/reference/types/unions.md @@ -5,7 +5,7 @@ Union types represent a value that can be one of a predefined set of types. A union type is defined by listing each of the types it may be, separated by the pipe operator, `|`. -```void +```voyd type Animal = Cat | Dog obj Cat { @@ -22,7 +22,7 @@ obj Dog { In some cases, where the nominal object is only ever used as part of a union, union sugar can be used -```void +```voyd union Drink Coffee { size: Size, sugar: Grams, cream: Grams } Tea { size: Size, sugar: Grams, cream: Grams } @@ -45,7 +45,7 @@ If all objects of a union have a method with the same signature (other than self (mutability excluded)). That method can be called directly from the union -```void +```voyd type Animal = Cat | Dog obj Cat {} diff --git a/src/__tests__/compiler.test.ts b/src/__tests__/compiler.test.ts index 83db1f80..10d2896b 100644 --- a/src/__tests__/compiler.test.ts +++ b/src/__tests__/compiler.test.ts @@ -11,7 +11,7 @@ import { getWasmFn, getWasmInstance } from "../lib/wasm.js"; import * as rCallUtil from "../assembler/return-call.js"; describe("E2E Compiler Pipeline", () => { - test("Compiler can compile and run a basic void program", async (t) => { + test("Compiler can compile and run a basic voyd program", async (t) => { const mod = await compile(e2eVoidText); const instance = getWasmInstance(mod); const fn = getWasmFn("main", instance); diff --git a/src/assembler.ts b/src/assembler.ts index 17764081..41185384 100644 --- a/src/assembler.ts +++ b/src/assembler.ts @@ -9,7 +9,7 @@ import { Primitive, ObjectType, DsArrayType, - voidBaseObject, + voydBaseObject, UnionType, IntersectionType, } from "./syntax-objects/types.js"; @@ -469,7 +469,7 @@ export const mapBinaryenType = ( if (isPrimitiveId(type, "f32")) return binaryen.f32; if (isPrimitiveId(type, "i64")) return binaryen.i64; if (isPrimitiveId(type, "f64")) return binaryen.f64; - if (isPrimitiveId(type, "void")) return binaryen.none; + if (isPrimitiveId(type, "voyd")) return binaryen.none; if (type.isObjectType()) return buildObjectType(opts, type); if (type.isUnionType()) return buildUnionType(opts, type); if (type.isDsArrayType()) return buildDsArrayType(opts, type); @@ -495,7 +495,7 @@ const buildUnionType = (opts: MapBinTypeOpts, union: UnionType): TypeRef => { union.types.forEach((type) => mapBinaryenType(opts, type)); - const typeRef = mapBinaryenType(opts, voidBaseObject); + const typeRef = mapBinaryenType(opts, voydBaseObject); union.setAttribute("binaryenType", typeRef); return typeRef; }; @@ -579,7 +579,7 @@ const buildObjectType = (opts: MapBinTypeOpts, obj: ObjectType): TypeRef => { if (obj.getAttribute("isStructural")) { obj.setAttribute("originalType", obj.binaryenType); - obj.binaryenType = mapBinaryenType(opts, voidBaseObject); + obj.binaryenType = mapBinaryenType(opts, voydBaseObject); } if (opts.useOriginalType) return binaryenType; diff --git a/src/assembler/field-lookup-helpers.ts b/src/assembler/field-lookup-helpers.ts index 17deb905..cb6e2960 100644 --- a/src/assembler/field-lookup-helpers.ts +++ b/src/assembler/field-lookup-helpers.ts @@ -16,7 +16,7 @@ import { import { IntersectionType, ObjectType, - voidBaseObject, + voydBaseObject, } from "../syntax-objects/types.js"; import { murmurHash3 } from "../lib/murmur-hash.js"; import { @@ -117,7 +117,7 @@ export const initFieldLookupHelpers = (mod: binaryen.Module) => { const accessor = mod.addFunction( accessorName, - bin.createType([mapBinaryenType(opts, voidBaseObject)]), + bin.createType([mapBinaryenType(opts, voydBaseObject)]), mapBinaryenType(opts, field.type!), [], structGetFieldValue({ @@ -126,7 +126,7 @@ export const initFieldLookupHelpers = (mod: binaryen.Module) => { fieldIndex: index + 2, // Skip RTT type fields exprRef: refCast( mod, - mod.local.get(0, mapBinaryenType(opts, voidBaseObject)), + mod.local.get(0, mapBinaryenType(opts, voydBaseObject)), mapBinaryenType(opts, obj) ), }) diff --git a/src/lib/config/README.md b/src/lib/config/README.md index d924610d..16ddf4ee 100644 --- a/src/lib/config/README.md +++ b/src/lib/config/README.md @@ -1,6 +1,6 @@ # Config Lib -This folder contains a lib for working with void configuration. +This folder contains a lib for working with voyd configuration. The idea is to merge all configuration sources (global and local config files, cli options etc) and return a single config object. diff --git a/src/lib/config/types.ts b/src/lib/config/types.ts index b520ace6..598e748f 100644 --- a/src/lib/config/types.ts +++ b/src/lib/config/types.ts @@ -13,11 +13,11 @@ export type VoidConfig = { runBinaryenOptimizationPass?: boolean; /** Emit CLI usage to stdout */ showHelp?: boolean; - /** Emit void version to stdout */ + /** Emit voyd version to stdout */ showVersion?: boolean; /** Run the compiled wasm code */ run?: boolean; - /** Specifies the entry void file */ + /** Specifies the entry voyd file */ index: string; /** Run the internal test script */ internalTest?: boolean; diff --git a/src/lib/resolve-src.ts b/src/lib/resolve-src.ts index 83c7bf3e..75c073e1 100644 --- a/src/lib/resolve-src.ts +++ b/src/lib/resolve-src.ts @@ -10,23 +10,23 @@ export type SrcInfo = { * Resolves src code location information. * * Assumes either a single file to compile or a directory with an index file. - * I.E. Single File === `src/test.void` or Directory === `src`. + * I.E. Single File === `src/test.voyd` or Directory === `src`. * * Will return only the index file path if a single file is provided. - * Will return the srcRootPath and index file path as srcRootPath + index.void if a directory is provided. + * Will return the srcRootPath and index file path as srcRootPath + index.voyd if a directory is provided. */ export async function resolveSrc(index: string): Promise { const indexPath = path.resolve(index); const parsedIndexPath = path.parse(indexPath); const indexStats = await stat(indexPath); - if (!indexStats.isDirectory() && parsedIndexPath.ext !== ".void") { + if (!indexStats.isDirectory() && parsedIndexPath.ext !== ".voyd") { throw new Error(`Invalid file extension ${parsedIndexPath.ext}`); } if (indexStats.isDirectory()) { return { - indexPath: path.join(indexPath, "index.void"), + indexPath: path.join(indexPath, "index.voyd"), srcRootPath: indexPath, }; } diff --git a/src/parser/__tests__/fixtures/parse-text-void-file.ts b/src/parser/__tests__/fixtures/parse-text-voyd-file.ts similarity index 83% rename from src/parser/__tests__/fixtures/parse-text-void-file.ts rename to src/parser/__tests__/fixtures/parse-text-voyd-file.ts index e03ad3be..f29149e5 100644 --- a/src/parser/__tests__/fixtures/parse-text-void-file.ts +++ b/src/parser/__tests__/fixtures/parse-text-voyd-file.ts @@ -1,6 +1,6 @@ import { CharStream } from "../../char-stream.js"; -export const parseFileVoidText = ` +export const parseFileVoydText = ` fn fib(n: i32) -> i32 if n <= 1 then: n @@ -35,4 +35,4 @@ fn main() let result = fib(n) `; -export const voidFile = new CharStream(parseFileVoidText, "beep/boop"); +export const voydFile = new CharStream(parseFileVoydText, "beep/boop"); diff --git a/src/parser/__tests__/fixtures/void-file.ts b/src/parser/__tests__/fixtures/voyd-file.ts similarity index 96% rename from src/parser/__tests__/fixtures/void-file.ts rename to src/parser/__tests__/fixtures/voyd-file.ts index e8150d6b..223f9d32 100644 --- a/src/parser/__tests__/fixtures/void-file.ts +++ b/src/parser/__tests__/fixtures/voyd-file.ts @@ -1,4 +1,4 @@ -export const voidFile = ` +export const voydFile = ` use std::macros::all use std::io::{ read, write: io_write } @@ -115,7 +115,7 @@ fn main() } `; -export const voidFileWithGenerics = ` +export const voydFileWithGenerics = ` use std::all type DsArrayi32 = DsArray diff --git a/src/parser/__tests__/parse-chars.test.ts b/src/parser/__tests__/parse-chars.test.ts index e352882d..024a3600 100644 --- a/src/parser/__tests__/parse-chars.test.ts +++ b/src/parser/__tests__/parse-chars.test.ts @@ -1,8 +1,8 @@ import { parseChars } from "../parse-chars.js"; -import { voidFile } from "./fixtures/parse-text-void-file.js"; +import { voydFile } from "./fixtures/parse-text-voyd-file.js"; import { test } from "vitest"; test("should parse the example file into a raw ast", async ({ expect }) => { - const parserOutput = parseChars(voidFile); + const parserOutput = parseChars(voydFile); expect(parserOutput).toMatchSnapshot(); }); diff --git a/src/parser/__tests__/parser.test.ts b/src/parser/__tests__/parser.test.ts index d4b59ad7..642c5608 100644 --- a/src/parser/__tests__/parser.test.ts +++ b/src/parser/__tests__/parser.test.ts @@ -1,11 +1,11 @@ import { parse } from "../parser.js"; -import { voidFile, voidFileWithGenerics } from "./fixtures/void-file.js"; +import { voydFile, voydFileWithGenerics } from "./fixtures/voyd-file.js"; import { test } from "vitest"; test("parser can parse a file into a syntax expanded ast", async (t) => { - t.expect(parse(voidFile)).toMatchSnapshot(); + t.expect(parse(voydFile)).toMatchSnapshot(); }); test("parser supports generics", async (t) => { - t.expect(parse(voidFileWithGenerics)).toMatchSnapshot(); + t.expect(parse(voydFileWithGenerics)).toMatchSnapshot(); }); diff --git a/src/parser/utils/parse-directory.ts b/src/parser/utils/parse-directory.ts index a12e7ada..4ece8898 100644 --- a/src/parser/utils/parse-directory.ts +++ b/src/parser/utils/parse-directory.ts @@ -6,7 +6,7 @@ import { parseFile } from "./parse-file.js"; export type ParsedFiles = { [filePath: string]: List }; export const parseDirectory = async (path: string): Promise => { - const files = await glob(resolve(path, "**/*.void")); + const files = await glob(resolve(path, "**/*.voyd")); const parsed = await Promise.all( files.map(async (filePath) => ({ diff --git a/src/parser/utils/parse-module.ts b/src/parser/utils/parse-module.ts index 0a837ae9..52426fab 100644 --- a/src/parser/utils/parse-module.ts +++ b/src/parser/utils/parse-module.ts @@ -6,13 +6,13 @@ import { parseStd } from "./parse-std.js"; export type ParsedModule = { files: ParsedFiles; - /** Path to src directory (a folder containing index.void that acts as entry) if available */ + /** Path to src directory (a folder containing index.voyd that acts as entry) if available */ srcPath?: string; - /** Path to root void file */ + /** Path to root voyd file */ indexPath: string; }; -/** Parses void text and std lib into a module unit */ +/** Parses voyd text and std lib into a module unit */ export const parseModule = async (text: string): Promise => { return { files: { @@ -23,7 +23,7 @@ export const parseModule = async (text: string): Promise => { }; }; -/** Parses a void codebase source and std into a module unit */ +/** Parses a voyd codebase source and std into a module unit */ export const parseModuleFromSrc = async ( path: string ): Promise => { diff --git a/src/semantics/__tests__/__snapshots__/modules.test.ts.snap b/src/semantics/__tests__/__snapshots__/modules.test.ts.snap index 375d0c09..ac29c61b 100644 --- a/src/semantics/__tests__/__snapshots__/modules.test.ts.snap +++ b/src/semantics/__tests__/__snapshots__/modules.test.ts.snap @@ -596,7 +596,7 @@ exports[`module registration 1`] = ` [ "memory", "copy", - "void", + "voyd", ], [ "dest", diff --git a/src/semantics/__tests__/fixtures/regular-macros-void-file.ts b/src/semantics/__tests__/fixtures/regular-macros-voyd-file.ts similarity index 96% rename from src/semantics/__tests__/fixtures/regular-macros-void-file.ts rename to src/semantics/__tests__/fixtures/regular-macros-voyd-file.ts index de866e33..85cc1601 100644 --- a/src/semantics/__tests__/fixtures/regular-macros-void-file.ts +++ b/src/semantics/__tests__/fixtures/regular-macros-voyd-file.ts @@ -1,4 +1,4 @@ -export const regularMacrosVoidFile = ` +export const regularMacrosVoydFile = ` macro \`() quote quote $@body diff --git a/src/semantics/__tests__/modules.test.ts b/src/semantics/__tests__/modules.test.ts index 9dac71b2..b98a6238 100644 --- a/src/semantics/__tests__/modules.test.ts +++ b/src/semantics/__tests__/modules.test.ts @@ -10,7 +10,7 @@ test("module registration", (t) => { const input = { files: { - "/Users/drew/projects/void/example.void": new List({ + "/Users/drew/projects/voyd/example.voyd": new List({ value: [ "ast", ["use", ["::", ["::", "std", "macros"], "all"]], @@ -99,7 +99,7 @@ const input = { ], ], }), - [`${stdPath}/deep/nested/hey.void`]: new List({ + [`${stdPath}/deep/nested/hey.voyd`]: new List({ value: [ "ast", ["use", ["::", ["::", "super", "macros"], "all"]], @@ -113,7 +113,7 @@ const input = { ], ], }), - [`${stdPath}/deep/nested.void`]: new List({ + [`${stdPath}/deep/nested.voyd`]: new List({ value: [ "ast", ["pub", ["use", ["::", "hey", "all"]]], @@ -127,7 +127,7 @@ const input = { ], ], }), - [`${stdPath}/deep/mod.void`]: new List({ + [`${stdPath}/deep/mod.voyd`]: new List({ value: [ "ast", ["pub", ["use", ["::", "hey", "all"]]], @@ -141,7 +141,7 @@ const input = { ], ], }), - [`${stdPath}/memory.void`]: new List({ + [`${stdPath}/memory.voyd`]: new List({ value: [ "ast", ["use", ["::", ["::", "super", "macros"], "all"]], @@ -159,7 +159,7 @@ const input = { "block", [ "bnr", - ["memory", "copy", "void"], + ["memory", "copy", "voyd"], ["dest", "src", ["size", "src"]], ], "dest", @@ -167,10 +167,10 @@ const input = { ], ], }), - [`${stdPath}/index.void`]: new List({ + [`${stdPath}/index.voyd`]: new List({ value: ["ast", ["pub", ["use", ["::", "macros", "all"]]]], }), }, - srcPath: "/Users/drew/projects/void", - indexPath: "/Users/drew/projects/void/index.void", + srcPath: "/Users/drew/projects/voyd", + indexPath: "/Users/drew/projects/voyd/index.voyd", }; diff --git a/src/semantics/__tests__/regular-macros.test.ts b/src/semantics/__tests__/regular-macros.test.ts index 6a563504..b3d02e03 100644 --- a/src/semantics/__tests__/regular-macros.test.ts +++ b/src/semantics/__tests__/regular-macros.test.ts @@ -2,12 +2,12 @@ import { parse } from "../../parser/parser.js"; import path from "node:path"; import { registerModules } from "../modules.js"; import { expandRegularMacros } from "../regular-macros.js"; -import { regularMacrosVoidFile } from "./fixtures/regular-macros-void-file.js"; +import { regularMacrosVoydFile } from "./fixtures/regular-macros-voyd-file.js"; import { test } from "vitest"; import { List } from "../../syntax-objects/list.js"; test("regular macro expansion", async (t) => { - const parserOutput = parse(regularMacrosVoidFile); + const parserOutput = parse(regularMacrosVoydFile); const files = { std: new List([]), test: parserOutput, @@ -15,7 +15,7 @@ test("regular macro expansion", async (t) => { const resolvedModules = registerModules({ files, srcPath: path.dirname("test"), - indexPath: "test.void", + indexPath: "test.voyd", }); const result = expandRegularMacros(resolvedModules); t.expect(result).toMatchSnapshot(); diff --git a/src/semantics/check-types.ts b/src/semantics/check-types.ts index 23afaf9f..bf38925b 100644 --- a/src/semantics/check-types.ts +++ b/src/semantics/check-types.ts @@ -145,7 +145,7 @@ export const checkIf = (call: Call) => { const thenExpr = checkTypes(call.argAt(1)); const elseExpr = call.argAt(2) ? checkTypes(call.argAt(2)) : undefined; - // Until unions are supported, return void if no else + // Until unions are supported, return voyd if no else if (!elseExpr) { call.type = dVoid; return call; diff --git a/src/semantics/init-primitive-types.ts b/src/semantics/init-primitive-types.ts index 9959576b..bc38dbea 100644 --- a/src/semantics/init-primitive-types.ts +++ b/src/semantics/init-primitive-types.ts @@ -1,5 +1,5 @@ import { i32, f32, i64, f64, bool, dVoid } from "../syntax-objects/types.js"; -import { voidBaseObject } from "../syntax-objects/types.js"; +import { voydBaseObject } from "../syntax-objects/types.js"; import { SemanticProcessor } from "./types.js"; export const initPrimitiveTypes: SemanticProcessor = (expr) => { @@ -10,6 +10,6 @@ export const initPrimitiveTypes: SemanticProcessor = (expr) => { expr.registerExport(f64); expr.registerExport(bool); expr.registerExport(dVoid); - expr.registerExport(voidBaseObject); + expr.registerExport(voydBaseObject); return expr; }; diff --git a/src/semantics/modules.ts b/src/semantics/modules.ts index b53c7a8f..5373afed 100644 --- a/src/semantics/modules.ts +++ b/src/semantics/modules.ts @@ -94,7 +94,7 @@ const filePathToModulePath = (filePath: string, srcPath: string) => { ? finalPath.replace(srcPath, "src") : finalPath; - finalPath = finalPath.replace(".void", ""); + finalPath = finalPath.replace(".voyd", ""); return finalPath; }; diff --git a/src/semantics/resolution/resolve-call-types.ts b/src/semantics/resolution/resolve-call-types.ts index 92e2f1cc..fb6e0075 100644 --- a/src/semantics/resolution/resolve-call-types.ts +++ b/src/semantics/resolution/resolve-call-types.ts @@ -115,7 +115,7 @@ export const resolveIf = (call: Call) => { const thenExpr = call.argAt(1); const elseExpr = call.argAt(2); - // Until unions are supported, return void if no else + // Until unions are supported, return voyd if no else if (!elseExpr) { call.type = dVoid; return call; diff --git a/src/semantics/resolution/resolve-object-type.ts b/src/semantics/resolution/resolve-object-type.ts index 1b86a84c..83ef23c7 100644 --- a/src/semantics/resolution/resolve-object-type.ts +++ b/src/semantics/resolution/resolve-object-type.ts @@ -4,7 +4,7 @@ import { List } from "../../syntax-objects/list.js"; import { ObjectType, TypeAlias, - voidBaseObject, + voydBaseObject, } from "../../syntax-objects/types.js"; import { getExprType } from "./get-expr-type.js"; import { implIsCompatible, resolveImpl } from "./resolve-impl.js"; @@ -30,7 +30,7 @@ export const resolveObjectTypeTypes = ( const parentType = getExprType(obj.parentObjExpr); obj.parentObjType = parentType?.isObjectType() ? parentType : undefined; } else { - obj.parentObjType = voidBaseObject; + obj.parentObjType = voydBaseObject; } obj.typesResolved = true; diff --git a/src/semantics/resolution/resolve-types.ts b/src/semantics/resolution/resolve-types.ts index 5d6c0ef8..400b4fc0 100644 --- a/src/semantics/resolution/resolve-types.ts +++ b/src/semantics/resolution/resolve-types.ts @@ -8,7 +8,7 @@ import { DsArrayType, ObjectType, TypeAlias, - voidBaseObject, + voydBaseObject, } from "../../syntax-objects/types.js"; import { Variable } from "../../syntax-objects/variable.js"; import { getExprType } from "./get-expr-type.js"; @@ -111,7 +111,7 @@ const resolveObjectLiteralTypes = (obj: ObjectLiteral) => { typeExpr: f.initializer, type: f.type, })), - parentObj: voidBaseObject, + parentObj: voydBaseObject, }); obj.type.setAttribute("isStructural", true); } diff --git a/src/syntax-objects/README.md b/src/syntax-objects/README.md index 2e975970..bf885bc0 100644 --- a/src/syntax-objects/README.md +++ b/src/syntax-objects/README.md @@ -1,6 +1,6 @@ # Syntax Objects -Syntax objects are data structures that represent void's language constructs. This includes functions, function calls, variables etc. +Syntax objects are data structures that represent voyd's language constructs. This includes functions, function calls, variables etc. # Guidelines diff --git a/src/syntax-objects/types.ts b/src/syntax-objects/types.ts index b17834bc..a1e33eed 100644 --- a/src/syntax-objects/types.ts +++ b/src/syntax-objects/types.ts @@ -345,7 +345,7 @@ export class FnType extends BaseType { } export type StackType = NumericType | ReferenceType; -export type Primitive = NumericType | ReferenceType | "void" | "bool"; +export type Primitive = NumericType | ReferenceType | "voyd" | "bool"; export type NumericType = "i32" | "f32" | "i64" | "f64"; export type ReferenceType = "funcref" | "externref"; @@ -354,8 +354,8 @@ export const f32 = PrimitiveType.from("f32"); export const i64 = PrimitiveType.from("i64"); export const f64 = PrimitiveType.from("f64"); export const bool = PrimitiveType.from("bool"); -export const dVoid = PrimitiveType.from("void"); -export const voidBaseObject = new ObjectType({ +export const dVoid = PrimitiveType.from("voyd"); +export const voydBaseObject = new ObjectType({ name: "Object", value: [], }); diff --git a/std/array.void b/std/array.voyd similarity index 100% rename from std/array.void rename to std/array.voyd diff --git a/std/index.void b/std/index.voyd similarity index 100% rename from std/index.void rename to std/index.voyd diff --git a/std/macros.void b/std/macros.voyd similarity index 100% rename from std/macros.void rename to std/macros.voyd diff --git a/std/operators.void b/std/operators.voyd similarity index 100% rename from std/operators.void rename to std/operators.voyd diff --git a/std/strings.void b/std/strings.voyd similarity index 100% rename from std/strings.void rename to std/strings.voyd diff --git a/std/utils.void b/std/utils.voyd similarity index 100% rename from std/utils.void rename to std/utils.voyd