All Projects → c2lang → C2compiler

c2lang / C2compiler

Licence: apache-2.0
the c2 programming language

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to C2compiler

Opal
Ruby ♥︎ JavaScript
Stars: ✭ 4,552 (+690.28%)
Mutual labels:  compiler
Luago Book
《自己动手实现Lua》随书源代码
Stars: ✭ 514 (-10.76%)
Mutual labels:  compiler
V
Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. https://vlang.io
Stars: ✭ 26,283 (+4463.02%)
Mutual labels:  compiler
Turboscript
Super charged typed JavaScript dialect for parallel programming which compiles to WebAssembly
Stars: ✭ 487 (-15.45%)
Mutual labels:  compiler
Langcraft
Compiler from LLVM IR to Minecraft datapacks.
Stars: ✭ 495 (-14.06%)
Mutual labels:  compiler
Jtransc
Bytecode to source converting Java & Kotlin code into JavaScript, C++, D, C#, PHP, AS3, Dart and Haxe and run it everywhere. Also use JVM code in your favourite language as a library.
Stars: ✭ 532 (-7.64%)
Mutual labels:  compiler
Eslisp
un-opinionated S-expression syntax and macro system for JavaScript
Stars: ✭ 481 (-16.49%)
Mutual labels:  compiler
Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (-1.74%)
Mutual labels:  compiler
Libfsm
DFA regular expression library & friends
Stars: ✭ 512 (-11.11%)
Mutual labels:  compiler
Esbuild
An extremely fast JavaScript and CSS bundler and minifier
Stars: ✭ 29,374 (+4999.65%)
Mutual labels:  compiler
Awesome Tensor Compilers
A list of awesome compiler projects and papers for tensor computation and deep learning.
Stars: ✭ 490 (-14.93%)
Mutual labels:  compiler
Roslynclrheapallocationanalyzer
Roslyn based C# heap allocation diagnostic analyzer that can detect explicit and many implicit allocations like boxing, display classes a.k.a closures, implicit delegate creations, etc.
Stars: ✭ 492 (-14.58%)
Mutual labels:  compiler
Acwj
A Compiler Writing Journey
Stars: ✭ 5,891 (+922.74%)
Mutual labels:  compiler
Pikelet
A friendly little systems language with first-class types. Very WIP! 🚧 🚧 🚧
Stars: ✭ 485 (-15.8%)
Mutual labels:  compiler
Gscript
framework to rapidly implement custom droppers for all three major operating systems
Stars: ✭ 547 (-5.03%)
Mutual labels:  compiler
Walt
⚡ Walt is a JavaScript-like syntax for WebAssembly text format ⚡
Stars: ✭ 4,513 (+683.51%)
Mutual labels:  compiler
Flow9
Platform for safe, easy and productive programming of complex, multi-platform apps with a modern user interface
Stars: ✭ 520 (-9.72%)
Mutual labels:  compiler
Dcc
DCC (Dex-to-C Compiler) is method-based aot compiler that can translate DEX code to C code.
Stars: ✭ 568 (-1.39%)
Mutual labels:  compiler
Estrella
Lightweight and versatile build tool based on the esbuild compiler
Stars: ✭ 543 (-5.73%)
Mutual labels:  compiler
Playwithcompiler
A GeekTime course about constructing a compiler.
Stars: ✭ 543 (-5.73%)
Mutual labels:  compiler

C2Compiler

Please see C2Lang.org for more info about C2!

The C2 project attempts to create a new language, strongly based on C. In a nutshell, the main differences with C are:

  • no more header files (too much typing)
  • no includes
  • packages (needed if we can't have includes)
  • compiled per target (not per file)
  • more logical keywords (public/local replaces static)
  • integrated build system

Below are the instructions for building and using the C2Compiler.

Have fun! (and code..)

Generic

C2 is based on LLVM 7.0 and some parts of Clang 7.0. The design of C2C's Parser and ASTBuilder classes are heavily based on clang's Parser and Sema class, so hereby my thanks to the Clang folks!

What needs to be done

A short list of open items (the full list would probably fill-up GitHub) with their priority:

  • [high] c2c: parse full syntax into AST (ALMOST DONE)
  • [high] c2c: generate IR code for more AST elements
  • [medium] tool: create graphical refactor tool (c2reto) (IN PROGRESS)
  • [medium] c2c: tab completion on targets in recipe / cmdline args
  • [medium] tool: create c-parser for parsing C headers.
  • [medium] tool: create c2format - astyle for C2.
  • [low] tool: c2grep - grep only files in recipe

Installation

Read the installation document for installation on Linux or OSX. For Windows installation, see windows installation document.

Using the C2 compiler

By default, c2c will only parse and analyse the targets. Generating C-code should work on all examples, but generating LLVM's IR code is work in progress. In the examples directory: (or add -d examples/)

c2c multi
c2c hello
c2c puzzle
c2c -I working_ir

It's also possible to manually compile a single .c2 file without a recipe file with:

c2c -f <file.c2>

To generate ANSI-C code, use:

c2c -C <target>

The C2 compiler is able to generate a package dependency file in dot format. This file can be converted into a png as follows:

c2c --deps <target>
dot -T png output/target/deps.dot > image.png

To see all available options, run:

c2c -h

c2tags

c2tags is C2's version of ctags. This tool is used by vim (e.a.) to "jump to definition". See the installation document on how to install.

How it works is as follows:

  • use --refs or add $refs in recipe.txt to generate refs file during compilation.
  • c2c generates a refs file per target. This file contains all references and their respective destinations.
  • c2tags currently doesn't have a full-blown vim-plugin yet, but a small code-fragment in your .vimrc should suffice.
  • Pressing ctrl-h (configurable) with your cursor on any symbol will jump to its definition. Pressing ctrl-o (default) will jump back.

Just like c2c itself, c2tags can be called from any (sub)directory in the project tree.

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].