Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Jule

< >

Jule is an open source programming language created in 2021 by Mertcan Davulcu.

#714on PLDB 3Years Old
Download source code:
git clone https://github.com/julelang/jule
Homepage ยท Source Code ยท Docs

Jule is the simple, efficient, statically typed and compiled system programming language.


Example from the web:
fn quicksort(mut s: []int) { if s.len <= 1 { ret } let mut i = -1 let last = s[s.len-1] for j in s { let mut x = &s[j] if (unsafe{ *x <= last }) { i++ let mut y = &s[i] unsafe { *x, *y = *y, *x } } } quicksort(s[:i]) quicksort(s[i+1:]) } fn main() { let mut my_slice = [1, 9, -2, 25, -24, 4623, 0, -1, 0xFD2] outln(my_slice) quicksort(my_slice) outln(my_slice) }
Example from the web:
fn main() { outln("Hello World") }
Example from the web:
use std::math::{PI} trait Shape { fn area(self): f32 } struct Rectangle { width: int height: int } impl Shape for Rectangle { fn area(self): f32 { ret self.width * self.height } } struct Circle { r: f32 } impl Shape for Circle { fn area(self): f32 { ret PI * self.r * self.r } } fn main() { let rect: Shape = Rectangle{90, 5} let circ: Shape = Circle{90.5} outln(rect.area()) outln(circ.area()) }
fn pub struct enum unsafe const let mut self match if else for in impl trait break continue goto cpp i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 str int uint type any true false bool ret fall nil uintptr co

Language features

Feature Supported Example Token
hasReservedWords โœ“
hasSelfOrThisWord โœ“ self
File Imports โœ“ use std::fs use std::sys::{self, open, O_RDWR} use std::math::* use
Multiline Strings โœ“ `Multiline strings is available in Jule with raw strings`
hasStringConcatOperator โœ“ +
Disk Output โœ“ use std::fs::{open, O_WRONLY} fn main() { let (mut f, _) = open("myfile.txt", O_WRONLY, 0) let bytes = ([]byte)("Text to write") f.write(bytes) f.close() }
Static Typing โœ“
Increment and decrement operators โœ“ ++ --
Conditionals โœ“ if BOOLEAN_EXPRESSION { outln(""Condition is true) }
Manual Memory Management โœ“ use std::mem::c::{malloc, free} fn main() { let mut ptr = malloc(8) free(ptr) ptr = nil }
Type Casting โœ“ let x = (int)(3.14)
hasArraySlicingSyntax โœ“ sliceable_expression[start_index:to_index]
Duck Typing โœ“ fn lock_object[T](obj: T) { obj.lock() }
Switch Statements โœ“ match X { | Y: outln("X is Y") | Z: outln("X is Z") | A | B | C: outln("X is A, B, or C") |: outln("X is not Y, Z, A, B and C") }
hasMemberVariables โœ“
Access Modifiers โœ“ pub
Type Annotations โœ“ let x: f64 = 89
Assignment โœ“ let mut x = 0 x = 20 =
Threads โœ“ fn my_thread() { outln("Hello from thread") } fn main() { co my_thread() }
Statements โœ“
hasStatementTerminatorCharacter โœ“ ;
hasBoundedCheckedArrays โœ“ let arr: [5]byte = ['a', 'b', 'c', 'd', 'e']
hasRequiredMainFunction โœ“ fn main() {}
Gotos โœ“ goto a_label
Labels โœ“ a_label:
hasDynamicSizedArrays โœ“ let mut a_slice = [1, 2, 3, 4, 5, 6] a_slice = append(a_slice, 7, 8, 9, 10)
hasIfElses โœ“
hasIfs โœ“
Doc comments โœ“ // Documentation comment for a_function fn a_function() {}
While Loops โœ“ for my_condition { // ... }
hasForLoops โœ“ // Jule has for loops with while-next iterations let mut i = 0 for i < 10; i++ { // ... }
hasForEachLoops โœ“ for x, y in my_enumerable { // ... }
canReadCommandLineArgs โœ“ use std::os::{ARGS} fn main() { outln(ARGS) }
Case Sensitivity โœ“
hasFnArguments โœ“
Dependent types โœ“ int uint uintptr
Unary Operators โœ“ * & - + ^ !
Variadic Functions โœ“ fn average(x: ...f64): f64 { // ... }
Assert Statements โœ“ use std::debug use std::debug::assert::{assert} fn main() { std::debug::ENABLE = true let x = 200 assert(x < 200) }
Bitwise Operators โœ“ & | ^ << >>
Directives โœ“
hasValueReturnedFunctions โœ“ fn get_pi(): f64 { ret 3.14159265359 }
hasGlobalScope โœ“
Scientific Notation โœ“ 1E2 .12345E+6 1.e+0 0x15e-2 0x2.p10 0X.8p-0 0x1.Fp+0 0x1fffp-16 0x1p-2
hasVoidFunctions โœ“ fn a_void_function() { // ... }
Binary Literals โœ“ 85
Decimals โœ“ 12345
Octals โœ“ 455
Hexadecimals โœ“ 917392
Structs โœ“ struct Employee { first_name: str last_name: str salary: f32 }
Integers โœ“ 12345 0b0001010101 0455 0xDFF90
Floats โœ“ 3.14 32.60 032.60 3. 0.3 1E2 .12345E+6 1.e+0 0x1p-2 0x2.p10 0x1.Fp+0 0X.8p-0 0x1fffp-16 0x15e-2
Enums โœ“ enum ExitCode { Success = 0, Failure = 1 }
hasContinue โœ“ continue continue a_label
hasBreak โœ“ break break a_label
Anonymous Functions โœ“ let anonymous = fn() { outln("Anonymous Function") } anonymous()
Null โœ“ nil
Constants โœ“ const PI = 3.14159265359
Booleans โœ“ true false true false
Generics โœ“ fn generic_function[T](s: []T) { // ... }
Traits โœ“ trait Person { fn get_full_name(self): str fn get_age(self): byte }
Maps โœ“ let my_map: [int:str] = { 0: "Key 0", 1: "Key 1", 2: "Key 2", }
Methods โœ“ impl MyStruct { fn my_method(self) {} }
Functions โœ“ fn a_function() { // ... }
Pointers โœ“ let ptr: *int = nil
Print() Debugging โœ“ outln
MultiLine Comments โœ“ /* A multi line comment */ /* */
Comments โœ“ // A comment /* A comment */
Line Comments โœ“ // A comment //
Strings โœ“ "Jule String Literal" `Jule Raw String Literal` "
Regular Expression Syntax Sugar X
hasTryCatch X
Async Await X
canUseQuestionMarksAsPartOfIdentifier X
Ternary operators X
hasUserDefinedOperators X
Operator Overloading X
Polymorphism X
Garbage Collection X
hasMethodOverloading X
Function Overloading X
Semantic Indentation X

- Build the next great programming language ยท Add ยท About ยท Search ยท Keywords ยท Livestreams ยท Labs ยท Resources ยท Acknowledgements

Built with Scroll v144.0.0