Skip to content

Commit

Permalink
fix: various typos across the whole repo
Browse files Browse the repository at this point in the history
i used https://github.com/crate-ci/typos to automatically spellcheck and apply fixes to the codebase.
every single line is manually reviewed by me. no breaking changes.
i also added a workflow to automatically find typos :)

Signed-off-by: Adam Perkowski <adas1per@protonmail.com>
  • Loading branch information
adamperkowski committed Jan 13, 2025
1 parent 844c1a7 commit 6c4b201
Show file tree
Hide file tree
Showing 75 changed files with 219 additions and 193 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Check typos

on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:

jobs:
check-typos:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run spellcheck
uses: crate-ci/typos@latest
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ It contains the reference compiler, API, and standard library.
### Key Features

- Optimized for fast and safe programs
- Empowered compile-time: reflection, evalutation, matching, and more by the standard comptime library
- Empowered compile-time: reflection, evaluation, matching, and more by the standard comptime library
- Deterministic memory management with reference-counting and smart pointers
- [Easy cross compilation](https://manual.jule.dev/compiler/cross-compilation): generate IR for target platform and imitate tge target architecture
- [Easy cross compilation](https://manual.jule.dev/compiler/cross-compilation): generate IR for target platform and imitate the target architecture
- Cross platform implemented standard library
- Built-in support to write tests
- Built-in [concurrency](https://manual.jule.dev/concurrency/): easy to use managed threads, channels, mutexes, condition variables and more
Expand Down
9 changes: 9 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[default]
extend-ignore-identifiers-re = [
"datas", "Datas", "inh", "nd", "lok",
"sur", "leasure", "asure", "nulll", "finf",
"iy", "ERROR_FILENAME_EXCED_RANGE", "FLE",
"nam", "ND", "eisDST", "ue", "Vai", "VAI",
"fo", "hel", "IST", "Commun", "constrait",
"cutted"
]
2 changes: 1 addition & 1 deletion api/ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ namespace jule
}

// Drops reference.
// This function will destruct this instace for reference counting.
// This function will destruct this instance for reference counting.
// Frees memory if reference counting reaches to zero.
void dealloc(void) const noexcept
{
Expand Down
4 changes: 2 additions & 2 deletions src/julec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The AST acts as a tool for the compiler to generate the compiler IR.

The next stage is semantic analysis.
In the semantic analysis process, type checking is performed for type safety purposes, declarations and definitions are checked, object binding (associating references to a definition with the definition) and some operations are performed.
As a result of the semantic analysis, the IR to be used by the compiler is also builded.
As a result of the semantic analysis, the IR to be used by the compiler is also built.
This IR is different representation from the AST and contains additional information such as references for object binding.

After the front-end is complete, the middle-end comes into play.
Expand Down Expand Up @@ -73,6 +73,6 @@ Actually, JuleC just generates C++ code for now.

- **(2)** Definition elemination can performed before other optimizations. Because it's independent from other optimizations. It might be increase performance because of eliminated definitions if performed before other optimizations.

- **(3)** Scope part of deadcoe elimination optimizations, should be executed after other optimizations. Because other optimzations may will change code structure, so some scope deadcode elimination cases may occur. This possible optimizations cannot catched by scope optimizer if scope deadcode elimination optimizations applied before other independent middle-end optimizations.
- **(3)** Scope part of deadcoe elimination optimizations, should be executed after other optimizations. Because other optimizations may will change code structure, so some scope deadcode elimination cases may occur. This possible optimizations cannot caught by scope optimizer if scope deadcode elimination optimizations applied before other independent middle-end optimizations.

- **(4)** For C/C++ IRs, include linked standard headers before the API. Otherwise it may cause compilation errors. For example, on Windows, `winsock2.h` must be included before `windows.h`. In a case where the API includes `windows.h` it is against this to later include `winsock2.h`.
6 changes: 3 additions & 3 deletions src/julec/obj/cxx/expr.jule
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ impl exprCoder {
// Function used as anonymous.
// So pass nullptr to ctx parameter.
// Do not pass nullptr if function is anonymous,
// beacause it stores ctx data internally and it will pass.
// because it stores ctx data internally and it will pass.
self.oc.write("nullptr")
if len(m.Args) > 0 {
self.oc.write(", ")
Expand Down Expand Up @@ -1048,7 +1048,7 @@ impl exprCoder {
fn indexing(mut &self, mut m: &sema::IndexingExpr) {
match type m.Expr.Model {
| &constant::Const:
// Cosntant string indexed. Use fast way, avoid making literal.
// Constant string indexed. Use fast way, avoid making literal.
self.oc.write(typeCoder.Str + "::at(")
if !env::Production {
self.oc.write("\"")
Expand Down Expand Up @@ -1269,7 +1269,7 @@ impl exprCoder {
}

// Writes complete expression model of function instance.
// Usefull for strict type safety.
// Useful for strict type safety.
fn funcInsCommon(mut &self, mut m: &sema::FuncIns) {
self.oc.tc.func(self.oc.Buf, m)
self.oc.write("(")
Expand Down
2 changes: 1 addition & 1 deletion src/julec/obj/cxx/ident.jule
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl identCoder {
for _, r in []rune(ident) {
if r < utf8::RuneSelf { // ASCII
// Cast to byte to enable compiler optimization.
// Append directy to buf.
// Append directly to buf.
buf.WriteByte(byte(r))!
continue
}
Expand Down
8 changes: 4 additions & 4 deletions src/julec/obj/cxx/object.jule
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ impl ObjectCoder {
self.indent()
self.write("return ")
self.addIndent()
mut writed := false
mut written := false

// Common model for custom expressions.
mut lmodel := "_self_->"
Expand All @@ -722,10 +722,10 @@ impl ObjectCoder {
if strct != nil && strct.Decl != nil && strct.Decl.Binded {
continue
}
if writed {
if written {
self.write(" &&")
}
writed = true
written = true
self.write("\n")
self.indent()

Expand All @@ -739,7 +739,7 @@ impl ObjectCoder {
rmodel = rmodel[:len(rmodel)-fIdent.Len()]
}
self.doneIndent()
if !writed {
if !written {
self.write("true")
}
self.write(";\n")
Expand Down
12 changes: 6 additions & 6 deletions src/julec/obj/cxx/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -452,19 +452,19 @@ impl scopeCoder {
}

fn conditional(mut &self, mut c: &sema::Conditional) {
mut writed := false
mut written := false
for (_, mut elif) in c.Elifs {
if elif == nil {
continue
}
if writed {
if written {
self.oc.write(" else ")
}
writed = true
written = true
self.ifCase(elif)
}
if c.Default != nil {
if writed {
if written {
self.oc.write(" else ")
}
self.scope(c.Default.Scope)
Expand Down Expand Up @@ -1035,7 +1035,7 @@ impl scopeCoder {
// Most common use case, assume 1 chan-recv/chan-send per case.
// In the end, len(chans) equals to total count of chans.
// All elements, matched by index which returned by the select algorithm.
// So chans[i] always the mached case, if exist.
// So chans[i] always the matched case, if exist.
mut chans := make([]chanCase, 0, len(slct.Cases))
mut &_chans := chans // Used by closure, unsafely.
obj::IterCaseExprs(slct.Cases, fn(mut &c: &sema::Case, mut &expr: &sema::Data) {
Expand Down Expand Up @@ -1371,7 +1371,7 @@ impl scopeCoder {
}
}
} else if len(f.Decl.Result.Idents) == 1 {
// Non-tuple signle return type with identifier.
// Non-tuple single return type with identifier.
// Use [resultName] as identifier.
self.oc.indent()
self.oc.tc.kind(self.oc.Buf, f.Result)
Expand Down
4 changes: 2 additions & 2 deletions src/julec/obj/cxx/type.jule
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ impl resultCoder {
fn codeMut(mut self, mut &s: strings::Builder, mut &t: &sema::Type) {
if t.Binded() {
// TODO:
// this method should be handle structures separatelly
// this method should be handle structures separately
// because they are may use namespace directive,
// so same identifier may exist in different namespaces
// this makes the result identifier is non-unique
Expand Down Expand Up @@ -473,7 +473,7 @@ impl resultCoder {
}
}

// Reports wheter type supports initialization.
// Reports whether type supports initialization.
fn ableToInit(mut &t: &sema::Type): bool {
ret !t.Binded()
}
Expand Down
2 changes: 1 addition & 1 deletion src/julec/obj/expr_inspector.jule
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use "std/jule/sema"
// Expression model inspector.
struct ExprInspector {
// If it is true, skips child expression models of current handled model if exist.
// For exmaple, after handling binary expression, walker skips left and right operands.
// For example, after handling binary expression, walker skips left and right operands.
SkipChild: bool

handler: fn(mut &m: sema::Expr)
Expand Down
4 changes: 2 additions & 2 deletions src/julec/obj/ir.jule
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl IR {
}
}

// Returns all structures of main package and used pakcages.
// Returns all structures of main package and used packages.
// Ignores binded declarations, but appends strict type alias structures also.
// Appends used packages first, then the main package.
fn GetAllStructures(mut self): []&sema::Struct {
Expand All @@ -111,7 +111,7 @@ impl IR {
}
}

// Returns all globals of main package and used pakcages.
// Returns all globals of main package and used packages.
// Ignores binded declarations and constants.
// If orderDefs is true, orders defines of each package.
// Appends used packages first, then the main package.
Expand Down
2 changes: 1 addition & 1 deletion src/julec/obj/meta/meta.jule
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const linkpathStrings = "std/strings"
const linkpathMathCmplx = "std/math/cmplx"

// Program metadata for the main IR.
// All required packages use this metada collection instead of
// All required packages use this metadata collection instead of
// transferring data between algorithms.
// It is safe to read for concurrent implementations.
// In good practice, it should be build once.
Expand Down
2 changes: 1 addition & 1 deletion src/julec/opt/boundary.jule
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn possibleBoundaryRemove(mut &b: &boundary, model: sema::Expr) {
ret
}
}
// Varaible is not in boundary b,
// Variable is not in boundary b,
// so seek in size variables to remove if exist.
mut i := 0
for i < len(b.vars); i++ {
Expand Down
2 changes: 1 addition & 1 deletion src/julec/opt/data.jule
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ lookup:
}

impl data {
// Remove the alive variables wich is not alive in other data.
// Remove the alive variables which is not alive in other data.
fn removeDeads(mut self, &other: &data) {
if self.boundary != nil && other.boundary != nil {
_removeDeads(self.boundary, other.boundary, invalidBoundary)
Expand Down
24 changes: 12 additions & 12 deletions src/julec/opt/expr.jule
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl exprOptimizer {
| &sema::BinaryExpr:
mut binary := (&sema::BinaryExpr)(m)

// Do not continue to checking. Binay expression is using || operator.
// Do not continue to checking. Binary expression is using || operator.
// So we can't know whether operands are guaranteed to be executed.
// For example:
//
Expand Down Expand Up @@ -151,7 +151,7 @@ impl exprOptimizer {
| token::Id.DblAmper:
if c.ReadBool() {
// Use left operand as model directly.
// Logical and with constant true exprssion is always will be true.
// Logical and with constant true expression is always will be true.
// The non-constant left operand should be true,
// this is the only important thing. So eliminate constant true.
*self.model = m.Left.Model
Expand All @@ -170,7 +170,7 @@ impl exprOptimizer {
*self.model = c
} else {
// Use left operand as model directly.
// Logical or with constant false exprssion is always will be false.
// Logical or with constant false expression is always will be false.
// The non-constant left operand should be true,
// this is the only important thing. So eliminate constant false.
*self.model = m.Left.Model
Expand Down Expand Up @@ -315,7 +315,7 @@ impl exprOptimizer {
// Parts should be in same addition order of the source code.
// By operator precedence and CAST production,
// the first node of the CAST is always the last binary expression.
// For exampple:
// For example:
// _ = "foo" + x + "bar" + "baz"
// ^
// In the expression above, the first binary expression node will be pointed one.
Expand Down Expand Up @@ -349,14 +349,14 @@ impl exprOptimizer {
ret false
}
if c.ReadStr() == "" && m.Op.Id == token::Id.Plus {
// Concatenation with empty string, use the non-constnat operand's model.
// Concatenation with empty string, use the non-constant operand's model.
*self.model = nc.Model
ret true
}
ret false
}

// Following algoritms are designed for zero-constant math operations.
// Following algorithms are designed for zero-constant math operations.
// So make required conditions are guaranteed.
if !Math || c.AsF64() != 0 {
ret false
Expand Down Expand Up @@ -394,7 +394,7 @@ impl exprOptimizer {
// Tries optimize binary expression for neutral elements.
// Specialized in math optimizations.
fn tryNeutralElement(self, mut &m: &sema::BinaryExpr): bool {
// For netural element optimization, one of the operands should be constant.
// For neutral element optimization, one of the operands should be constant.
match type m.Left.Model {
| &constant::Const:
mut c := (&constant::Const)(m.Left.Model)
Expand Down Expand Up @@ -517,7 +517,7 @@ impl exprOptimizer {
fn binaryMath(self, mut &m: &sema::BinaryExpr): (applied: bool) {
// Break optimizations if types are not primitive.
// No need for checking whether types are arithmetic,
// because relevant operators are conly avaliable for arithmetic primitives.
// because relevant operators are only available for arithmetic primitives.
lp := m.Left.Type.Prim()
if lp == nil {
ret false
Expand All @@ -529,7 +529,7 @@ impl exprOptimizer {

match m.Op.Id {
| token::Id.Plus:
// If type is integer and expressions is like "x+x", then we can simplfy to "x<<1" which is faster.
// If type is integer and expressions is like "x+x", then we can simplify to "x<<1" which is faster.
// Floating-point types is exceptional because we cannot predict the result because of NaN or similar values.
// Also floating-point types are not supports bit shifting operators.
if !types::IsInt(lp.Kind) || !obj::EqualModels(m.Left.Model, m.Right.Model) {
Expand All @@ -545,7 +545,7 @@ impl exprOptimizer {
*self.model = unsafe { *(*sema::Expr)(&model) }
ret true
| token::Id.Minus:
// If type is integer and expressions is like "x-x", then we can simplfy to "0" which is cheaper.
// If type is integer and expressions is like "x-x", then we can simplify to "0" which is cheaper.
// Floating-point types is exceptional because we cannot predict the result because of NaN or similar values.
if !types::IsInt(lp.Kind) || !obj::EqualModels(m.Left.Model, m.Right.Model) {
break
Expand Down Expand Up @@ -698,7 +698,7 @@ impl exprOptimizer {
// There is no risk for checkpoint data mutation. Do soft load.
self.data.loadCheckpoint(checkpoint.getMutCheckpoint())

// Childs are optmized. Now, we can skip childs of binary expression.
// Children are optimized. Now, we can skip children of binary expression.
// Avoid duplicated analysis.
self.inspector.SkipChild = true
}
Expand Down Expand Up @@ -727,7 +727,7 @@ impl exprOptimizer {
mut model := any(&UnsafeDerefExpr{Base: m})
*self.model = unsafe { *(*sema::Expr)(&model) }
} else {
// Now this varible is safe until it mutated.
// Now this variable is safe until it mutated.
self.data.nils.pushVar(var, true)
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/julec/opt/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl scopeOptimizer {
ret
}

mut constCase := false // Has cosntant true case.
mut constCase := false // Has constant true case.

// Remove unnecessary trailing cases that comes after constant true case.
for (i, mut elif) in c.Elifs {
Expand Down Expand Up @@ -243,7 +243,7 @@ impl scopeOptimizer {
ret
}

mut constCase := false // Has cosntant true case.
mut constCase := false // Has constant true case.

// Remove unnecessary trailing cases that comes after constant true case.
for (mut i, mut case) in m.Cases {
Expand Down Expand Up @@ -815,14 +815,14 @@ impl scopeOptimizer {
// Expressions will be more simple, so analysis may have optimization chance.
self.normalizeAssign(assign, tup)

// Split assignments as a signle assignment if possible.
// Split assignments as a single assignment if possible.
// Because multi-assign expressions use temporary values.
// So, remove temporary variables using single assignments if possible.
self.splitAssign(assign, tup)

// Try to optimize swap assignment if possible.
// Do it now, because assignment may be splitted,
// so optimization may be possible compared to non-splitted form.
// Do it now, because assignment may be split,
// so optimization may be possible compared to non-split form.
self.tryOptimizeSwap(assign, tup)

// after all of these optimizations,
Expand Down
2 changes: 1 addition & 1 deletion std/bufio/scan.jule
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct Scanner {
start: int // First non-processed byte in buf.
end: int // End of data in buf.
empties: int // Count of successive empty tokens.
mut tok: []byte // The last readed token.
mut tok: []byte // The last read token.
}

impl Scanner {
Expand Down
Loading

0 comments on commit 6c4b201

Please sign in to comment.