Git Product home page Git Product logo

arocc's Introduction

Aro

A C compiler with the goal of providing fast compilation and low memory usage with good diagnostics.

Currently it can preprocess, parse and semantically analyze ~85% of standard C17 with work still being needed to support all of the usual extensions.

Basic code generation is supported for x86-64 linux and can produce a valid hello world:

$ cat hello.c
extern int printf(const char *restrict fmt, ...);
int main(void) {
    printf("Hello, world!\n");
    return 0;
}
$ zig build run -- hello.c -o hello
$ ./hello
Hello, world!
$

Future plans for the project include making it the C backend of Zig's translate-c feature and making it an optional C frontend for the self-hosted Zig compiler.

#define MAIN ma##in

#ifndef FOO
int *something[5];
#endif

#if defined MAIN
int MAIN(int argc, const char *argv[]) {
    return (argc * (char)4)[argv];
}
#endif
var: '[5]*int'
 name: something

fn_def: 'fn (argc: int, argv: **const char) int'
 name: main
 body:
  compound_stmt_two: 'void'
    return_stmt: 'void'
     expr:
      array_access_expr: '*const char' lvalue
       lhs:
        lval_to_rval: '**const char'
          decl_ref_expr: '**const char' lvalue
           name: argv
       index:
        paren_expr: 'int'
         operand:
          mul_expr: 'int'
           lhs:
            lval_to_rval: 'int'
              decl_ref_expr: 'int' lvalue
               name: argc
           rhs:
            int_cast: 'int' (value: 4)
              cast_expr: 'char'
               operand:
                int_literal: 'int'
                 value: 4

types are printed in Zig style as C types are more confusing than necessary, actual error messages contain proper C like types

arocc's People

Contributors

doppioandante avatar ehaas avatar happyfacade avatar iddev5 avatar moosichu avatar sagehane avatar twoclocks avatar vexu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.