All Projects → c3lang → C3c

c3lang / C3c

Licence: lgpl-3.0
Compiler for the C3 language

Programming Languages

c
50402 projects - #5 most used programming language
language
365 projects

Labels

Projects that are alternatives of or similar to C3c

C
Compile and execute C "scripts" in one go!
Stars: ✭ 1,920 (+978.65%)
Mutual labels:  compiler
Ddc
The Disco Discus Compiler
Stars: ✭ 164 (-7.87%)
Mutual labels:  compiler
Lexical syntax analysis
编译原理词法分析器&语法分析器LR(1)实现 C++
Stars: ✭ 173 (-2.81%)
Mutual labels:  compiler
Rhine
🔬 a C++ compiler middle-end, using an LLVM backend
Stars: ✭ 157 (-11.8%)
Mutual labels:  compiler
One
On-device Neural Engine
Stars: ✭ 162 (-8.99%)
Mutual labels:  compiler
Redacted Compiler Plugin
A Kotlin compiler plugin that generates redacted toString() implementations.
Stars: ✭ 168 (-5.62%)
Mutual labels:  compiler
Cs2cpp
C# to C++ transpiler (Cs2Cpp) (Powered by Roslyn)
Stars: ✭ 155 (-12.92%)
Mutual labels:  compiler
Command Block Assembly
Compile high-level code into Minecraft commands
Stars: ✭ 175 (-1.69%)
Mutual labels:  compiler
Compile To Web
Discover what languages can be compiled to Web Assembly
Stars: ✭ 164 (-7.87%)
Mutual labels:  compiler
Corewar
A reproduction of the Core War game. Assembly compiler, Virtual Machine and GUI.
Stars: ✭ 173 (-2.81%)
Mutual labels:  compiler
Bytecode Viewer
A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
Stars: ✭ 12,606 (+6982.02%)
Mutual labels:  compiler
Elena Lang
ELENA is a general-purpose language with late binding. It is multi-paradigm, combining features of functional and object-oriented programming. Rich set of tools are provided to deal with message dispatching : multi-methods, message qualifying, generic message handlers, run-time interfaces
Stars: ✭ 161 (-9.55%)
Mutual labels:  compiler
Poprc
A Compiler for the Popr Language
Stars: ✭ 170 (-4.49%)
Mutual labels:  compiler
Eval
Eval is a lightweight interpreter framework written in Swift, evaluating expressions at runtime
Stars: ✭ 157 (-11.8%)
Mutual labels:  compiler
Inmemoryjavacompiler
Utility class to compile java source code in memory
Stars: ✭ 174 (-2.25%)
Mutual labels:  compiler
Lbac Swift
Let's Build a Compiler by Jack Crenshaw translated to Swift Playgrounds
Stars: ✭ 156 (-12.36%)
Mutual labels:  compiler
Awesome Machine Learning In Compilers
Must read research papers and links to tools and datasets that are related to using machine learning for compilers and systems optimisation
Stars: ✭ 168 (-5.62%)
Mutual labels:  compiler
Wag
WebAssembly compiler implemented in Go
Stars: ✭ 177 (-0.56%)
Mutual labels:  compiler
Play with llvm
A book about LLVM & Clang(中文开源书:玩转 LLVM)
Stars: ✭ 175 (-1.69%)
Mutual labels:  compiler
Xl
A minimalist, general-purpose programming language based on meta-programming and parse tree rewrites
Stars: ✭ 171 (-3.93%)
Mutual labels:  compiler

C3 Language

C3 is a C-like language trying to be "an incremental improvement over C" rather than a whole new language. C3 owes a lot to the ideas of the C2 language: to iterate on top of C without trying to be a whole new language.

C3 tries to be an alternative in the the C/C++ niche: fast and close to the metal.

Design Principles

  • Procedural "get things done"-type of language.
  • Try to stay close to C - only change where truly needed.
  • C ABI compatibility and excellent C integration.
  • Learning C3 should be easy for a C programmer.
  • Data is inert.
  • Avoid "big ideas" & the "more is better" fallacy.
  • Introduce some higher level conveniences where the value is great.

Example code

module hello_world;
import std::io;

func void main()
{
   io::printf("Hello, world!\n");
}

In what ways do C3 differ from C?

  • No mandatory header files
  • New semantic macro system
  • Generic modules
  • Module based
  • Subarrays (slices) and vararrays built in
  • Compile time reflection
  • Enhanced compile time execution
  • "Result" based zero overhead error handling
  • Defer
  • Value methods
  • Associated enum data
  • Built in strings
  • No preprocessor
  • Undefined behaviour trapped on debug by default
  • Optional pre and post conditions

Current status

It's possible to try out the current C3 compiler in the browser: https://ide.judge0.com/ – this is courtesy of the developer of Judge0.

Design work is still being done in the design draft here: https://c3lang.github.io/c3docs/. If you have any suggestions, send a mail to [email protected], [file an issue] (https://github.com/c3lang/c3c/issues) or discuss C3 on its dedicated Discord: https://discord.gg/qN76R87

Todo / done

  • [x] For/while/do
  • [x] if/ternary
  • [x] Structs
  • [x] Union
  • [x] Enums
  • [x] Value methods
  • [x] Compound literals
  • [x] Designated initalizers
  • [x] Slicing syntax
  • [x] Arrays and subarrays
  • [x] Modules
  • [x] $unreachable
  • [x] Compile time assert with $assert
  • [x] Compiler guiding assert
  • [x] C code calling by declaring methods extern
  • [x] Compile time variables
  • [x] Basic macros
  • [x] 4cc, 8cc, 2cc
  • [x] Enum type inference in switch/assignment
  • [x] Integer type inference
  • [x] Error type
  • [x] Failable error handling
  • [x] try for conditional execution
  • [x] catch for error handling
  • [x] Implicit unwrap after catch
  • [x] sizeof
  • [x] typeof
  • [x] 2s complement wrapping operators
  • [x] Labelled break / continue
  • [x] next statement
  • [x] Expression blocks
  • [x] Do-without-while
  • [x] Foreach statement
  • [ ] All attributes
  • [ ] Associative array literals
  • [ ] CT type constants
  • [ ] Reflection methods
  • [ ] Anonymous structs
  • [x] Distinct types
  • [ ] LTO/ThinLTO setup
  • [ ] Built-in linking
  • [ ] global / shared for globals
  • [ ] Complex macros
  • [x] CT only macros evaluating to constants
  • [ ] Escape macros
  • [ ] Implicit capturing macros
  • [ ] Trailing body macros
  • [ ] Subarray initializers
  • [x] range initializers e.g. { [1..2] = 2 }
  • [ ] Bitstructs
  • [ ] asm section
  • [ ] $switch
  • [ ] $for
  • [ ] Pre-post conditions
  • [ ] Stdlib inclusion
  • [ ] Generic modules
  • [ ] String functions
  • [ ] Vararrays e.g. int[*]
  • [ ] Compile time incremental arrays
  • [ ] Complete C ABI conformance in progress
  • [ ] Generic functions
  • [ ] Debug info in progress
  • [ ] Simd vector types
  • [ ] Complex types

What can you help with?

  • If you wish to contribute with ideas, please file issues on the c3docs: https://github.com/c3lang/c3docs instead of the compiler.
  • Discuss the language on discord to help iron out syntax.
  • Stdlib work will soon start, do you want to help out building the C3 std lib?
  • Do you want to do real compiler work? Everyone is welcome to contribute.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].