└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # awesome-low-level-programming-languages 2 | 3 | A curated list of **low level** programming languages primarily aimed at OS and game 4 | programming. 5 | 6 | **Excluded are languages relying on managed run-times, GC, JITs, green threads, etc.** 7 | (For less exclusionary lists check [ChessMax](https://github.com/ChessMax/awesome-programming-languages) or 8 | [Wikipedia](https://en.wikipedia.org/wiki/List_of_programming_languages).) 9 | 10 | Feel free to send pull-requests with additions and corrections. 11 | 12 | 13 | Table of content 14 | 15 | - [awesome-low-level-programming-languages](#awesome-low-level-programming-languages) 16 | - [ATS](#ats) 17 | - [Ada](#ada) 18 | - [Alumina](#alumina) 19 | - [Beef](#beef) 20 | - [C](#c) 21 | - [C++](#c-1) 22 | - [C2](#c2) 23 | - [C3](#c3) 24 | - [Carp](#carp) 25 | - [Cone](#cone) 26 | - [Crystal](#crystal) 27 | - [CSpydr](#cspydr) 28 | - [D](#d) 29 | - [Forth](#forth) 30 | - [Hare](#hare) 31 | - [Hylo (formerly: Val)](#hylo) 32 | - [Jai](#jai) 33 | - [Kit](#kit) 34 | - [Lobster](#lobster) 35 | - [Modula-2](#modula-2) 36 | - [Nim](#nim) 37 | - [Oberon](#oberon) 38 | - [Odin](#odin) 39 | - [Pascal (FreePascal)](#pascal-freepascal) 40 | - [Rust](#rust) 41 | - [Scopes](#scopes) 42 | - [V](#v) 43 | - [Vale](#vale) 44 | - [Vox](#vox) 45 | - [Zig](#zig) 46 | 47 | 48 | Not yet summarized (pull requests welcome): 49 | 50 | [Austral](https://github.com/austral/austral), 51 | [Cakelisp](https://cakelisp.handmade.network/), 52 | [Carbon](https://github.com/carbon-language/carbon-lang), 53 | [eC](https://ec-lang.org/), 54 | [Helix](https://github.com/helixlang/helix-lang), 55 | [Inko](https://inko-lang.org/), 56 | [Jiyu](https://jiyu.handmade.network/), 57 | [LitaC](https://github.com/tonysparks/litac-lang), 58 | [Modula-3](https://en.wikipedia.org/wiki/Modula-3), 59 | [Move](https://move-language.github.io/move/), 60 | [Myr](https://myrlang.org/), 61 | [Neat](https://neat-lang.github.io/), 62 | [Nelua](https://nelua.io/), 63 | [Oak](https://github.com/adam-mcdaniel/oakc/), 64 | [Ocen](https://github.com/ocen-lang/ocen), 65 | [Seed7](http://seed7.sourceforge.net/), 66 | [Silk](https://github.com/AjayMT/silk), 67 | [Sparrow](https://github.com/Sparrow-lang/sparrow), 68 | [Swift](https://www.swift.org/), 69 | [Terra](https://terralang.org/), 70 | [Vala](https://wiki.gnome.org/Projects/Vala), 71 | 72 | 73 | ## ATS 74 | 75 | * main: http://www.ats-lang.org/ 76 | * repo: https://github.com/ats-lang 77 | * documentation: 78 | - http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/book1.html 79 | - http://www.ats-lang.org/Documents.html 80 | * discussion: 81 | - https://news.ycombinator.com/item?id=28214665 82 | - https://news.ycombinator.com/from?site=ats-lang.org 83 | * implementation-language: ATS 84 | * meta-programming: N/A 85 | * backends: C 86 | * major projects using the language: N/A 87 | * syntax: functional style 88 | * highlights: 89 | - proofs 90 | - dependent types 91 | - C code can be specified inline 92 | * [pldb](https://pldb.pub/concepts/ats.html) 93 | 94 | ``` 95 | #include "share/atspre_staload.hats" 96 | #include "share/atspre_staload_libats_ML.hats" 97 | 98 | implement 99 | main0() = println! ("Hello, world!") 100 | ``` 101 | 102 | ``` 103 | fun fibc (n: int) : int = let 104 | fun loop(n: int, f0: int, f1: int): int = 105 | if n > 0 then loop(n-1, f1, f0+f1) else f0 106 | end of [loop] 107 | in 108 | loop(n, 0, 1) 109 | end // end of [fibc] 110 | ``` 111 | 112 | ## Ada 113 | 114 | * main: 115 | 1. [Ada Information Clearing House](https://www.adaic.org) 116 | 2. [Ada Conformity Assessment Authority](http://www.ada-auth.org) 117 | 3. [Ada Language](https://ada-lang.io) (Community) 118 | * repo: N/A 119 | * documentation: 120 | - Reference Manuals: 121 | + [Ada 2022](http://www.ada-auth.org/standards/ada22.html) - Next 122 | + [Ada 2012](http://www.ada-auth.org/standards/ada12.html) - Current 123 | + [Ada 2005](https://www.adaic.org/ada-resources/standards/ada05) 124 | + [Ada 1995](https://www.adaic.org/ada-resources/standards/ada-95-documents) 125 | + [Ada 1983](https://www.adaic.org/ada-resources/standards/ada83) - First ISO standard 126 | - awesome-ada https://github.com/ohenley/awesome-ada 127 | - https://learn.adacore.com/ 128 | - http://groups.umd.umich.edu/cis/course.des/cis400/ada/ada.html 129 | * implementation-language: Ada, C 130 | * meta-programming: generics 131 | * error-handlig: exceptions 132 | * backends: GCC (gnat), [LLVM](https://github.com/AdaCore/gnat-llvm), several commerical implementations 133 | * major projects using the language: numerous 134 | * syntax: begin/end, type to the right of identifier 135 | * highlights: 136 | - type refinement 137 | - fixed point types 138 | - multitasking built in from the start 139 | - real-time constructs 140 | - hierarchical package system for separate compilation 141 | - design by contract 142 | - standard defined FFI for C, Fortran and COBOL 143 | * [pldb](https://pldb.pub/concepts/ada.html) 144 | ``` 145 | with Ada.Text_IO; 146 | 147 | procedure Hello_World is 148 | begin 149 | Ada.Text_IO.Put_Line ("Hello World"); 150 | end Hello_World; 151 | ``` 152 | 153 | ``` 154 | function fibonacci(n : in integer) return integer is 155 | f1, f2, fib : integer; 156 | begin 157 | f1 := 0; 158 | f2 := 1; 159 | for i in 1..n loop 160 | fib := f1 + f2; 161 | f1 := f2; 162 | f2 := fib; 163 | end loop; 164 | return fib; 165 | end fibonacci; 166 | ``` 167 | ## Alumina 168 | 169 | * main: https://docs.alumina-lang.net/ 170 | * repo: https://github.com/tibordp/alumina 171 | * documentation: 172 | - https://docs.alumina-lang.net/ 173 | * discussion: 174 | - https://news.ycombinator.com/item?id=32702812 175 | * implementation-language: Rust 176 | * meta-programming: (hygienic) macros, (duck-typed) generics, opt-in dynamic dispatch polymorphism 177 | * backends: compiles to C11 with GCC/Clang extensions 178 | * major projects using the language: N/A 179 | * syntax: curly braces, type to the right of identifier 180 | * highlights: 181 | - defer 182 | - uniform function call syntax 183 | - closures 184 | - block expressions 185 | * [pldb](https://pldb.pub/concepts/alumina.html) 186 | 187 | ``` 188 | fn main() { 189 | println!("Hello, world!"); 190 | } 191 | 192 | ``` 193 | 194 | ## Beef 195 | 196 | * main: https://www.beeflang.org/ 197 | * repo: https://github.com/beefytech/Beef/ 198 | * documentation: 199 | - awesome-beef https://github.com/Jonathan-Racaud/awesome-beef 200 | * discussion: 201 | - https://news.ycombinator.com/item?id=21991382 202 | * implementation-language: C++ 203 | * meta-programming: generics 204 | * backends: LLVM 205 | * major projects using the language: N/A 206 | * syntax: curly braces, type to the left of identifier 207 | * highlights: 208 | - inspired by C# 209 | - co-designed with IDE 210 | - windows centric development 211 | * [pldb](https://pldb.pub/concepts/beef.html) 212 | 213 | ``` 214 | using System; 215 | 216 | namespace Hello 217 | { 218 | class Program 219 | { 220 | static void Main() 221 | { 222 | Console.WriteLine("Hello, world!"); 223 | } 224 | } 225 | } 226 | ``` 227 | 228 | ``` 229 | N/A 230 | ``` 231 | 232 | ## C 233 | 234 | * main: N/A 235 | * repo: N/A 236 | * documentation: 237 | - https://github.com/inputsh/awesome-c 238 | - https://github.com/uhub/awesome-c 239 | * meta-programming: pre-processor 240 | * error-handling: magic return values by covention 241 | * backends: LLVM, gcc, numerous others 242 | * major projects using the language: numerous 243 | * syntax: curly braces, type to the left of identifier 244 | * highlights: 245 | - ubiquitous 246 | - often used as a backend 247 | - no namespaces 248 | - array to pointer auto conversion 249 | - no defer (or RAII) mechanism 250 | - lots of undefined / implementation defined behavior 251 | * [pldb](https://pldb.pub/concepts/c.html) 252 | 253 | ``` 254 | #include 255 | 256 | int main() { 257 | printf("Hello World!"); 258 | } 259 | ``` 260 | 261 | ``` 262 | int fib(int n) { 263 | int a = 0; 264 | int b = 1; 265 | for (int i = 0; i < n; i++) { 266 | int c = a + b; 267 | a = b; 268 | b = c; 269 | } 270 | return a; 271 | } 272 | ``` 273 | 274 | 275 | ## C++ 276 | * repo: 277 | * documentation: 278 | - standard https://isocpp.org/std/the-standard 279 | - reference https://en.cppreference.com/w/ 280 | - awesome-cpp https://github.com/fffaraz/awesome-cpp 281 | - AwesomePerfCpp https://github.com/fenbf/AwesomePerfCpp 282 | * meta-programming: 283 | - template meta programming 284 | - generics (types, functions) 285 | - comptime 286 | - macros 287 | * backends: LLVM, gcc, numerous others 288 | * major projects using the language: numerous 289 | * syntax: curly braces, type to the left of identifier 290 | * highlights: 291 | - large user base 292 | - several compilers 293 | - large language (evolving) 294 | - slow compiles 295 | * [pldb](https://pldb.pub/concepts/cpp.html) 296 | 297 | ``` 298 | #include 299 | 300 | int main() { 301 | std::cout << "Hello World!" << std::endl; 302 | } 303 | 304 | ``` 305 | 306 | ``` 307 | int fib(int n) { 308 | int a = 0; 309 | int b = 1; 310 | for (int i = 0; i < n; i++) { 311 | const int c = a + b; 312 | a = b; 313 | b = c; 314 | } 315 | return a; 316 | } 317 | ``` 318 | 319 | ## C2 320 | 321 | * main: http://www.c2lang.org/ 322 | * repo: https://github.com/c2lang/ 323 | * documentation: 324 | - http://c2lang.org/site/ 325 | * discussion: 326 | - https://news.ycombinator.com/from?site=c2lang.org 327 | * implementation-language: C++ 328 | * hello-world: http://www.c3-lang.org/firstproject/ 329 | * meta-programming: generics, N/A 330 | * backends: LLVM 331 | * major projects using the language: N/A 332 | * syntax: curly braces, type to the left of identifier 333 | * highlights: 334 | - modernized C 335 | * [pldb](https://pldb.pub/concepts/c2.html) 336 | 337 | ``` 338 | module hello_world; 339 | 340 | import stdio local; 341 | 342 | public func i32 main(i32 argc, i8** argv) { 343 | printf("Hello World!\n"); 344 | return 0; 345 | } 346 | 347 | ``` 348 | 349 | ``` 350 | func i32 fib(int n) { 351 | i32 a = 0; 352 | i32 b = 1; 353 | for (i32 i = 0; i < n; i++) { 354 | i32 c = a + b; 355 | a = b; 356 | b = c; 357 | } 358 | return a; 359 | } 360 | ``` 361 | 362 | ## C3 363 | 364 | * main: http://www.c3-lang.org/ 365 | * repo: https://github.com/c3lang/c3c 366 | * documentation: 367 | - http://www.c3-lang.org/compare/ 368 | * discussion: 369 | - https://news.ycombinator.com/item?id=27876570 370 | * implementation-language: C 371 | * hello-world: http://www.c3-lang.org/firstproject/ 372 | * meta-programming: generics, semantic macros 373 | * backends: LLVM 374 | * major projects using the language: N/A 375 | * syntax: curly braces, type to the left of identifier 376 | * highlights: 377 | - evolution of C 378 | - contracts 379 | * [pldb](https://pldb.pub/concepts/c3.html) 380 | 381 | ``` 382 | module hello_world; 383 | 384 | import std::io; 385 | 386 | fn int main(int argc, char** argv) { 387 | io::println("Hello World!"); 388 | return 0; 389 | } 390 | 391 | ``` 392 | 393 | ``` 394 | fn int fib(int n) { 395 | int a = 0; 396 | int b = 1; 397 | for (int i = 0; i < n; i++) { 398 | int c = a + b; 399 | a = b; 400 | b = c; 401 | } 402 | return a; 403 | } 404 | ``` 405 | 406 | ## Carp 407 | 408 | * main: https://github.com/carp-lang/Carp 409 | * repo: https://github.com/carp-lang/Carp 410 | * documentation: 411 | - language guide: https://github.com/carp-lang/Carp/blob/master/docs/LanguageGuide.md 412 | * discussion: 413 | - https://news.ycombinator.com/item?id=28875051 414 | - https://news.ycombinator.com/item?id=20368969 415 | * implementation-language: Haskell 416 | * meta-programming: generics 417 | * backends: N/A 418 | * major projects using the language: 419 | * syntax: Lisp like 420 | * highlights: 421 | - repl 422 | - ownership tracking 423 | * [pldb](https://pldb.pub/concepts/carp.html) 424 | 425 | ``` 426 | (println "hello world") 427 | ``` 428 | 429 | ``` 430 | N/A 431 | ``` 432 | 433 | ## Cone 434 | 435 | * main: https://cone.jondgoodwin.com/ 436 | * repo: https://github.com/jondgoodwin/cone 437 | * documentation: 438 | - reference: https://cone.jondgoodwin.com/coneref/index.html 439 | * discussion: 440 | - https://news.ycombinator.com/item?id=19565824 441 | * implementation-language: C 442 | * meta-programming: macros, generics (types, function, modules) 443 | * error-handling: execptions + special syntax for same line rethrowing/default values 444 | * backends: LLVM 445 | * major projects using the language: 446 | * syntax: optionally indentation sensitive, type to the right of identifier 447 | * highlights: 448 | - [Regions and Lifetimes](https://cone.jondgoodwin.com/memory.html) 449 | - [Permissions and Actors](https://cone.jondgoodwin.com/concurrency.html) 450 | - [Variants, Structural Traits & Delegated Inheritance](https://cone.jondgoodwin.com/types.html) 451 | - [<-, with, and match](https://cone.jondgoodwin.com/complexval.html) 452 | 453 | ``` 454 | import stdio 455 | 456 | fn main(): 457 | print <- "Hello world!" 458 | ``` 459 | 460 | ``` 461 | fn fib(n i64) i64: 462 | mut prior i64 = 0 463 | mut result i64 = 1 464 | while n-- > 0: 465 | prior, result = result, prior + result 466 | result 467 | 468 | ``` 469 | 470 | ## Crystal 471 | 472 | * main: https://crystal-lang.org/ 473 | * repo: https://github.com/crystal-lang/crystal 474 | * note: use garbage collection but it is possible to strip out runtime (see [Lilith Kernel](https://github.com/ffwff/lilith)) 475 | * documentation: 476 | - https://crystal-lang.org/reference/ 477 | * discussion: 478 | - https://news.ycombinator.com/from?site=kitlang.org 479 | * implementation-language: Crystal 480 | * meta-programming: [Sophisticated macro system](https://crystal-lang.org/reference/1.5/syntax_and_semantics/macros/) 481 | * backends: LLVM 482 | * major projects using the language: N/A 483 | * syntax: 484 | * highlights: 485 | - similar to ruby 486 | * [pldb](https://pldb.pub/concepts/crystal.html) 487 | 488 | ``` 489 | puts "Hello World" 490 | ``` 491 | 492 | ``` 493 | def fib(n) 494 | a = 0 495 | b = 1 496 | n.times do 497 | a += b 498 | a, b = b, a 499 | end 500 | a 501 | end 502 | ``` 503 | 504 | ## CSpydr 505 | 506 | * main: https://github.com/Spydr06/CSpydr 507 | * repo: https://github.com/Spydr06/CSpydr 508 | * documentation: https://github.com/Spydr06/CSpydr/wiki 509 | * implementation-language: C 510 | * meta-programming: macros 511 | * backends: x86_64 GNU Assembly, C (deprecated), LLVM (in progress) 512 | * major projects using the language: CSpydr's standard library 513 | * syntax: curly braces, type to the right of identifier with colon inbetween 514 | * highlights: 515 | - namespaces 516 | - closures 517 | - automatic type inferrence 518 | - custom std lib 519 | * [pldb](https://pldb.pub/concepts/cspydr.html) 520 | ``` 521 | import "std.csp"; 522 | 523 | fn main(): i32 { 524 | std::io::puts("Hello, World!"); 525 | <- 0; 526 | } 527 | ``` 528 | 529 | ``` 530 | fn fib(n: i32): i32 { 531 | let a = 0; 532 | let b = 1; 533 | for 0 .. n { 534 | a + b |> (a = b, b = $); 535 | } 536 | <- a; 537 | } 538 | ``` 539 | 540 | ## D 541 | 542 | * main: https://dlang.org/ 543 | * repo: https://github.com/dlang, https://github.com/ldc-developers/ldc, https://gdcproject.org/ 544 | * documentation: 545 | - spec https://dlang.org/spec/spec.html 546 | - overview https://dlang.org/comparison.html 547 | * implementation-language: D 548 | * meta-programming: generics 549 | * backends: Custom (X86-64), LLVM, gcc 550 | * major projects using the language: numerous 551 | * syntax: curly braces, type to the left of identifier 552 | * highlights: 553 | - large language 554 | - optional GC 555 | * [pldb](https://pldb.pub/concepts/d.html) 556 | 557 | ``` 558 | import std.stdio; 559 | 560 | void main() { 561 | writeln("Hello, World!"); 562 | } 563 | ``` 564 | 565 | ``` 566 | N/A 567 | ``` 568 | 569 | ## Forth 570 | 571 | * main: N/A 572 | * repo: N/A 573 | * documentation: 574 | - http://www.forth.org/ 575 | * implementation-language: C, assembler, 576 | * meta-programming: N/A 577 | * backends: Custom 578 | * major projects using the language: N/A 579 | * syntax: unique 580 | * highlights: 581 | - concatenative programming style 582 | - many different flavors 583 | - very easy to implement 584 | * [pldb](https://pldb.pub/concepts/forth.html) 585 | 586 | ``` 587 | : HELLO ."Hello World " ; 588 | 589 | ``` 590 | 591 | ``` 592 | : FIB ( x -- y ) RECURSIVE 593 | DUP 2 > IF DUP 1- RECURSE 594 | SWAP 2- RECURSE + EXIT 595 | ENDIF 596 | DROP 1 ; 597 | ``` 598 | 599 | ## Hare 600 | 601 | * main: https://harelang.org/ 602 | * repo: https://sr.ht/~sircmpwn/hare/ 603 | * documentation: 604 | - https://harelang.org/documentation/ 605 | * implementation-language: C 606 | * error-handling: via tagged unions 607 | * meta-programming: ??? 608 | * backends: QBE (restricted to 64bit: X86-64, AArch64) 609 | * major projects using the language: 610 | - https://sr.ht/~sircmpwn/himitsu/ 611 | - https://sr.ht/~sircmpwn/helios/ 612 | * syntax: curly braces, type to the right of identifier 613 | * [pldb](https://pldb.pub/concepts/hare.html) 614 | 615 | ``` 616 | use fmt; 617 | 618 | export fn main() void = { 619 | fmt::println("Hello, world!")!; 620 | }; 621 | ``` 622 | 623 | ``` 624 | N/A 625 | ``` 626 | 627 | ## Hylo 628 | 629 | (formerly: Val) 630 | (Needs more work - pull requests welcome) 631 | 632 | * main: https://www.hylo-lang.org 633 | * repo: https://github.com/hylo-lang/hylo 634 | * documentation: https://docs.hylo-lang.org/language-tour/ 635 | * discussion: https://news.ycombinator.com/item?id=31788527 636 | * implementation-language: Swift 637 | * meta-programming: 638 | * backends: 639 | * major projects using the language 640 | * syntax: curly braces, type to the right of identifier 641 | * highlights: value semantics 642 | 643 | ## Jai 644 | 645 | * main: N/A 646 | * repo: N/A 647 | * documentation: 648 | - inofficial https://inductive.no/jai/ 649 | - inofffical https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md 650 | - Jonathan Blow YT channel https://www.youtube.com/user/jblow888/videos 651 | - Community Library https://github.com/Jai-Community/Jai-Community-Library 652 | * implementation-language: C++ 653 | * meta-programming: macros 654 | * backends: LLVM (?), Custom 655 | * major projects using the language: N/A 656 | * syntax: N/A 657 | * highlights: 658 | - compile time execution 659 | 660 | ``` 661 | N/A 662 | ``` 663 | 664 | ``` 665 | N/A 666 | ``` 667 | 668 | ## Kit 669 | 670 | * main: https://www.kitlang.org/ 671 | * repo: https://github.com/kitlang/kit 672 | * documentation: 673 | * discussion: 674 | - https://news.ycombinator.com/from?site=kitlang.org 675 | * implementation-language: Haskell 676 | * meta-programming: 677 | * backends: C 678 | * major projects using the language: N/A 679 | * syntax: curly braces, type to the left of identifier 680 | * highlights: 681 | 682 | ``` 683 | function main() { 684 | printf("%s\n", "hello world!"); 685 | } 686 | ``` 687 | 688 | ``` 689 | N/A 690 | ``` 691 | 692 | ## Lobster 693 | 694 | * main: http://aardappel.github.io/lobster/README_FIRST.html 695 | * repo: https://github.com/aardappel/lobster 696 | * discussion: 697 | - https://news.ycombinator.com/item?id=19567160 698 | * implementation-language: C(++) 699 | * meta-programming: generics, comptime evals 700 | * backends: JIT (libtcc), C++ 701 | * major projects using the language: N/A 702 | * syntax: python inspired, white space sensitive 703 | * memory management: compile time reference counting, lifetime analysis, borrow checker, cycle detection at program exit. 704 | * highlights: 705 | - (flow sensitive) type inference 706 | 707 | ``` 708 | print "hello world" 709 | ``` 710 | 711 | ``` 712 | def fibonacci(n:int): 713 | var a = 0 714 | var b = 1 715 | for(n): 716 | let t = b 717 | b += a 718 | a = t 719 | return a 720 | ``` 721 | 722 | ## Modula-2 723 | 724 | * main: https://en.wikipedia.org/wiki/Modula-2 725 | * repo: 726 | - Gnu Modula 2 Frontend (gm2) https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/heads/devel/modula-2 727 | * documentation: 728 | - https://www.nongnu.org/gm2/homepage.html 729 | - https://freepages.modula2.org/ 730 | - https://www.modula-2.net/ 731 | * implementation-language: C (gm2) 732 | * meta-programming: None 733 | * backends: gcc (gm2) 734 | * major projects using the language: [Medos-2](https://en.wikipedia.org/wiki/Lilith_(computer)#Operating_system) 735 | * syntax: begin/end, type to the right of identifier 736 | * highlights: 737 | - Evolution of Pascal 738 | - Modules 739 | - Co-routines 740 | * [pldb](https://pldb.pub/concepts/modula-2.html) 741 | 742 | ``` 743 | MODULE Hello; 744 | FROM STextIO IMPORT WriteString; 745 | BEGIN 746 | WriteString("Hello World!") 747 | END Hello. 748 | ``` 749 | 750 | ``` 751 | PROCEDURE fib(n : INTEGER) : INTEGER; 752 | VAR 753 | a, b, c : INTEGER; 754 | BEGIN 755 | a := 0; 756 | b := 1; 757 | 758 | WHILE n > 0 DO 759 | c := a + b; 760 | a := b; 761 | b := c; 762 | DEC(n) 763 | END; 764 | 765 | RETURN a 766 | END fib; 767 | 768 | ``` 769 | 770 | ## Nim 771 | 772 | * main: https://nim-lang.org/ 773 | * repo: 774 | - https://github.com/nim-lang/Nim 775 | * documentation: 776 | - https://nim-lang.org/documentation.html 777 | * discussions: 778 | - https://news.ycombinator.com/item?id=24800161 779 | - https://news.ycombinator.com/item?id=27165366 780 | - https://news.ycombinator.com/item?id=28916172 781 | * implementation-language: Nim (self hosting) 782 | * error-handing: exceptions 783 | * meta-programming: macros manipulating the AST, generics, templates 784 | * backends: JS, C 785 | * memory management: ARC 786 | * major projects using the language: 787 | - Nim (self hosting) 788 | - https://github.com/dom96/jester 789 | - https://github.com/karaxnim/karax 790 | - https://github.com/planety/prologue 791 | * syntax: python inspired, white space sensitive 792 | * highlights: 793 | - c interop 794 | - async implemented as library 795 | - case insensitve identifiers 796 | * [pldb](https://pldb.pub/concepts/nim.html) 797 | 798 | ``` 799 | echo "Hello World" 800 | ``` 801 | 802 | ``` 803 | proc fib(n: uint64): uint64 = 804 | if n <= 1: return n 805 | return fib(n - 1) + fib(n - 2) 806 | ``` 807 | 808 | ## Oberon 809 | 810 | * main: http://www.projectoberon.com 811 | * note: 812 | - Oberon DOES use garbage collection but it has been used to implememt an influential OS of the same name 813 | so we include here. 814 | - There are serveral flavors of Oberon ( 815 | Oberon-2 (1992), 816 | [Obereon-7 (2007)](http://people.inf.ethz.ch/wirth/Oberon/Oberon07.Report.pdf), 817 | [Active Oberon](http://cas.inf.ethz.ch/projects/a2/repository/raw/trunk/LanguageReport/OberonLanguageReport.pdf), 818 | [Oberon+](https://github.com/oberon-lang) ) 819 | * repo: 820 | - Oberon+ https://github.com/oberon-lang/ 821 | * documentation: 822 | - http://www.projectoberon.com 823 | * discussion: 824 | - https://news.ycombinator.com/item?id=21557057 825 | * implementation-language: Oberon 826 | * meta-programming: None 827 | * backends: Custom 828 | * major projects using the language: Oberon-OS 829 | * syntax: begin/end, type to the right of identifier 830 | * highlights: 831 | - evolution of Pascal and Modula-2 832 | - deliberate small language 833 | * [pldb](https://pldb.pub/concepts/oberon.html) 834 | 835 | ``` 836 | MODULE Hello; 837 | IMPORT Oberon, Texts; 838 | VAR W: Texts.Writer; 839 | 840 | PROCEDURE World*; 841 | BEGIN 842 | Texts.WriteString(W, "Hello World!"); 843 | Texts.WriteLn(W); 844 | Texts.Append(Oberon.Log, W.buf); 845 | END World; 846 | 847 | BEGIN 848 | Texts.OpenWriter(W); 849 | END Hello. 850 | ``` 851 | 852 | ``` 853 | PROCEDURE fib(VAR n: INTEGER) : INTEGER; 854 | VAR 855 | a, b, c, i : INTEGER; 856 | BEGIN 857 | a := 0; 858 | b := 1; 859 | FOR i := 1 TO n DO 860 | c := a + b; 861 | a := b 862 | b := c 863 | END; 864 | RETURN a; 865 | END fib; 866 | ``` 867 | 868 | ## Odin 869 | 870 | * main: https://odin-lang.org/ 871 | * repo: https://github.com/odin-lang/Odin 872 | * documentation: 873 | - spec https://odin-lang.org/docs/spec/ 874 | - https://www.youtube.com/channel/UCUSck1dOH7VKmG4lRW7tZXg 875 | * discussion: 876 | - https://news.ycombinator.com/item?id=22199942 877 | * implementation-language: C++ 878 | * meta-programming: generics 879 | * error-handling: "go-style" via multiple return values 880 | * backends: LLVM 881 | * major projects using the language: [EmberGen](https://jangafx.com/software/embergen/) 882 | * syntax: curly braces, type to the right of identifier 883 | * highlights: 884 | - implcit context parameter 885 | * [pldb](https://pldb.pub/concepts/odin.html) 886 | 887 | ``` 888 | package main 889 | 890 | import "core:fmt" 891 | 892 | main :: proc() { 893 | fmt.println("Hello World!") 894 | } 895 | 896 | ``` 897 | 898 | ``` 899 | fibonacci :: proc(n: int) -> int { 900 | switch { 901 | case n < 1: 902 | return 0 903 | case n == 1: 904 | return 1 905 | } 906 | return fibonacci(n-1) + fibonacci(n-2) 907 | } 908 | 909 | ``` 910 | 911 | ## Pascal (FreePascal) 912 | 913 | 914 | * main: https://www.freepascal.org/ 915 | * repo: https://github.com/fpc 916 | * documentation: https://www.freepascal.org/docs.html 917 | * note: includes support for Delphi language extensions (classes, etc.) 918 | * discussion: 919 | - https://news.ycombinator.com/from?site=freepascal.org 920 | * implementation-language: Pascal 921 | * meta-programming: generics 922 | * backends: Custom(X86 (32+64), PowerPC (32+64), Sparc, ARM (32+64)) 923 | * major projects using the language 924 | * syntax: begin/end, type to the right of identifier 925 | * highlights: 926 | * [pldb](https://pldb.pub/concepts/pascal.html) 927 | 928 | ``` 929 | program Hello; 930 | begin 931 | writeln ('Hello, world.'); 932 | readln; 933 | end. 934 | ``` 935 | 936 | ``` 937 | function fibonacci(const n: integer): integer; 938 | var 939 | a, b, c, i: integer; 940 | begin 941 | a := 0; 942 | b := 1; 943 | for i := 1 to n do 944 | begin 945 | c := a + b; 946 | a := b; 947 | b := c; 948 | end; 949 | fibonacci := a 950 | end; 951 | ``` 952 | 953 | ## Rust 954 | 955 | * main: https://www.rust-lang.org/ 956 | * repo: https://github.com/rust-lang 957 | * documentation: 958 | - https://doc.rust-lang.org/book/ 959 | * implementation-language: Rust 960 | * meta-programming: 961 | - hygienic macros 962 | - generics/traits 963 | - comptime 964 | * backends: LLVM 965 | * major projects using the language: numerous (including large parts of [Firefox](https://www.mozilla.org/en-US/firefox/new/)) 966 | * syntax: curly braces, type to the right of identifier 967 | * highlights: 968 | - memory safety focus (ownership semantics) 969 | - immutable by default 970 | - bare metal programming via `no_std` environment 971 | - steep learning curve 972 | - large language 973 | - slow compiles 974 | * [pldb](https://pldb.pub/concepts/rust.html) 975 | 976 | ``` 977 | fn main() { 978 | println!("Hello World!"); 979 | } 980 | ``` 981 | 982 | ``` 983 | fn fib(n: u8) -> u64 { 984 | let mut prev: u64 = 0; 985 | let mut curr: u64 = 1; 986 | for _ in 1..n { 987 | let next = prev + curr; 988 | prev = curr; 989 | curr = next; 990 | } 991 | curr 992 | } 993 | ``` 994 | 995 | ## Scopes 996 | 997 | * main: https://scopes.readthedocs.io/en/latest/ 998 | * repo: https://hg.sr.ht/~duangle/scopes 999 | * documentation: 1000 | * discussion: 1001 | - https://news.ycombinator.com/item?id=19830860 1002 | - https://news.ycombinator.com/item?id=16603134 1003 | * implementation-language: C++ 1004 | * meta-programming: 1005 | * backends: LLVM 1006 | * major projects using the language 1007 | * syntax: indentation sensitive 1008 | * highlights: 1009 | - on-line compiler 1010 | 1011 | ``` 1012 | print "hello world" 1013 | 1014 | ``` 1015 | 1016 | ``` 1017 | fn fib (n) 1018 | loop (a b = 0 1) 1019 | if (b < n) 1020 | repeat b (a + b) 1021 | else 1022 | break b 1023 | 1024 | ``` 1025 | 1026 | ## V 1027 | 1028 | * main: https://vlang.io/ 1029 | * repo: https://github.com/vlang 1030 | * documentation: 1031 | - https://github.com/vlang/v/blob/master/doc/docs.md 1032 | * discussion: 1033 | - https://news.ycombinator.com/from?site=vlang.io 1034 | * implementation-language: V 1035 | * error-handling: special case of optional types, dedicated syntax 1036 | * meta-programming: generics 1037 | * backends: C, LLVM 1038 | * major projects using the language: N/A 1039 | * syntax: curly braces, type to the right of identifier 1040 | * highlights: 1041 | - go derived syntax 1042 | - immutable by default 1043 | - some confusion around memory-allocators and GC ("autofree") 1044 | * [pldb](https://pldb.pub/concepts/v.html) 1045 | ``` 1046 | fn main() { 1047 | println('Hello, World!') 1048 | } 1049 | ``` 1050 | 1051 | ``` 1052 | fn fn(n int) int { 1053 | mut a := 0 1054 | mut b := 1 1055 | for _ in 0 .. n { 1056 | c := a + b 1057 | a = b 1058 | b = c 1059 | } 1060 | return a 1061 | } 1062 | ``` 1063 | 1064 | ## Vale 1065 | 1066 | * main: https://vale.dev/ 1067 | * repo: https://github.com/ValeLang/Vale 1068 | * documentation: 1069 | - introduction https://vale.dev/guide/introduction 1070 | - https://www.reddit.com/r/vale/ 1071 | * discussion: 1072 | - https://news.ycombinator.com/item?id=16603134 1073 | - https://news.ycombinator.com/from?site=vale.dev 1074 | * implementation-language: Vale, Scala 1075 | * meta-programming: generics 1076 | * backends: LLVM 1077 | * major projects using the language: N/A 1078 | * syntax: curly braces, type to the right of identifier 1079 | * highlights: 1080 | - immutable by default 1081 | - ownership semantics 1082 | 1083 | ``` 1084 | fn main() export { 1085 | println("Hello world!"); 1086 | } 1087 | ``` 1088 | 1089 | ``` 1090 | N/A 1091 | ``` 1092 | 1093 | ## Vox 1094 | 1095 | * main: https://github.com/MrSmith33/vox 1096 | * repo: https://github.com/MrSmith33/vox 1097 | * documentation: N/A 1098 | * discussion: N/A 1099 | * implementation-language: D 1100 | * meta-programming: generics 1101 | * backends: Custom (X86-64) 1102 | * major projects using the language: N/A 1103 | * syntax: curly braces, type to the left of identifier 1104 | * highlights: 1105 | - AOT + JIT 1106 | 1107 | ``` 1108 | enum u32 stdin = 0; 1109 | enum u32 stdout = 1; 1110 | enum u32 stderr = 2; 1111 | 1112 | @extern(syscall, 60) 1113 | void exit(i32 error_code); 1114 | 1115 | @extern(syscall, 1) 1116 | void sys_write(u32 fd, u8* buf, u64 count); 1117 | 1118 | void write(u32 fd, u8[] data) { sys_write(fd, data.ptr, data.length); } 1119 | 1120 | void main(u8* lpCmdLine, i32 nShowCmd) { 1121 | write(stdout, msg); 1122 | exit(0); 1123 | } 1124 | ``` 1125 | 1126 | ``` 1127 | N/A 1128 | ``` 1129 | 1130 | ## Zig 1131 | 1132 | * main: https://ziglang.org 1133 | * repo: https://github.com/ziglang/zig 1134 | * documentation: 1135 | - https://ziglang.org/documentation/master/ 1136 | * discussion: 1137 | - https://news.ycombinator.com/item?id=25797025 1138 | - https://news.ycombinator.com/item?id=28458713 1139 | - https://news.ycombinator.com/item?id=27399876 1140 | - https://news.ycombinator.com/from?site=ziglang.org 1141 | * implementation-language: C++, Zig 1142 | * meta-programming: comptime (including types) 1143 | * error-handling: compiler built-in type, dedicated syntax 1144 | * backends: LLVM, custom 1145 | * major projects using the language: [tigerbeetle](https://github.com/tigerbeetle/tigerbeetle) [bun](https://github.com/oven-sh/bun) 1146 | * syntax: curly braces, type to the right of identifier 1147 | * highlights: 1148 | - small language 1149 | - testing built into the language 1150 | - variables must be declared via `const` (immutable) or `var` (mutable) 1151 | - no invisible control-flow 1152 | - defer/errdefer 1153 | * [pldb](https://pldb.pub/concepts/zig.html) 1154 | 1155 | ``` 1156 | const std = @import("std"); 1157 | 1158 | pub fn main() !void { 1159 | const stdout = std.io.getStdOut().writer(); 1160 | try stdout.print("Hello, {s}!\n", .{"world"}); 1161 | } 1162 | 1163 | ``` 1164 | 1165 | ``` 1166 | fn fibonacci(n: u32) u32 { 1167 | var a : u32 = 0; 1168 | var b : u32 = 1; 1169 | var i : u32 = 0 1170 | while (i < n) : (i += 1) { 1171 | const c : u32 = a + b; 1172 | a = b; 1173 | b = c; 1174 | } 1175 | return a; 1176 | } 1177 | ``` 1178 | 1179 | 1201 | --------------------------------------------------------------------------------