暂无描述

Jeroen van Rijn 5dcb5c2ba3 Merge pull request #367 from kevinw/fix-json-parsing 6 年之前
.github 6092cc0497 Add issue templates 6 年之前
bin cc14180e9d Update README.md 6 年之前
core 62f5eb5bca Fix som JSON parsing bugs. 6 年之前
examples a019059975 Fix -vet for demo.odin 6 年之前
misc f96fbc94c8 v0.9.0 Release 6 年之前
shared cc14180e9d Update README.md 6 年之前
src ecd2eacd75 Remove dead keywords; Fix `min` and `max` for enum types 6 年之前
.gitignore 12c810f85d Add a file-, console- and multi-logger 6 年之前
.travis.yml 24c43d33bb Export LLVM path on macOS (CI) 6 年之前
LICENSE 9a8759efef Polymorphic type specialization for procedures 8 年之前
Makefile 7343f0c7ff Fix recursive variable in makefile on macOS 6 年之前
PROPOSAL-PROCESS.md 133f88406f The Proposal Process 6 年之前
README.md c9602953aa last fixes to bats and README 6 年之前
appveyor.yml 0185b43c2f Create CI files 6 年之前
build.bat dd9113786c Remove -keep-temp-files from the build.bat 6 年之前
build.sh efe4b71bae Fix build.sh 7 年之前
build_ci.bat c9602953aa last fixes to bats and README 6 年之前

README.md

Odin logo
A fast, concise, readable, pragmatic and open sourced programming language.


The Odin Programming Language

The Odin programming language is fast, concise, readable, pragmatic and open sourced. It is designed with the intent of replacing C with the following goals:

  • simplicity
  • high performance
  • built for modern systems
  • joy of programming

Website: https://odin.handmade.network/

Documentation

  • Tutorial
  • Frequently Asked Questions

    package main
    
    import "core:fmt"
    
    main :: proc() {
    	program := "+ + * 😃 - /";
    	accumulator := 0;
    
    	for token in program {
    		switch token {
    		case '+': accumulator += 1;
    		case '-': accumulator -= 1;
    		case '*': accumulator *= 2;
    		case '/': accumulator /= 2;
    		case '😃': accumulator *= accumulator;
    		case: // Ignore everything else
    		}
    	}
    
    	fmt.printf("The program \"%s\" calculates the value %d\n",
    	           program, accumulator);
    }
    
    

Setup

Odin only supports x86-64 at the moment (64-bit), relies on LLVM for code generation and an external linker.

In addition, the following platform-specific steps are necessary:

  • Windows

    • Have Visual Studio installed (MSVC 2010 or later, for the linker)
    • Have a copy of opt.exe and llc.exe in Odin/bin. Pre-built Windows binaries can be found here and must be explicitly copied
    • Open a valid command prompt:
      • Basic: run the x64 Native Tools Command Prompt for VS2017 shortcut bundled with VS 2017, or
      • Advanced: run vcvarsall.bat x64 from a blank cmd session
  • MacOS

    • Have LLVM explicitly installed (brew install llvm)
    • Have XCode installed (version X.X or later, for linking)
    • Make sure the LLVM binaries and the linker are added to your $PATH environmental variable
  • GNU/Linux

    • Have LLVM installed (opt/llc)
    • Have Clang installed (version X.X or later, for linking)
    • Make sure the LLVM binaries and the linker are added to your $PATH environmental variable

Then build the compiler by calling build.bat (Windows) or make (Linux/MacOS). This will automatically run the demo program if successful.

Notes for Linux:: The compiler currently relies on the core and shared library collection being relative to the compiler executable. Installing the compiler in the usual sense (to /usr/local/bin or similar) is therefore not as straight forward as you need to make sure the mentioned libraries are available. As a result, it is recommended to simply explicitly invoke the compiler with /path/to/odin in your preferred build system, or add /path/to/odin to $PATH.

Please read the Getting Started Guide for more information.

Requirements to build and run

Please read the Getting Started Guide.

  • Windows

    • x86-64
    • MSVC 2010 installed (C++11 support)
    • LLVM binaries for opt.exe, llc.exe, and lld-link.exe
    • Requires MSVC's link.exe as the linker
      • run vcvarsall.bat to setup the path
  • MacOS

    • x86-64
    • LLVM explicitly installed (brew install llvm)
    • XCode installed (for the linker)
  • GNU/Linux

    • x86-64
    • Build tools (ld)
    • LLVM installed
    • Clang installed (temporary - this is Calling the linker for now)

Warnings

  • This is still highly in development and the language's design is quite volatile.
  • Syntax is not fixed.

Demonstrations: