Brainlet C Compiler


NAME
SYNOPSIS
DESCRIPTION
OPTIONS
OPERANDS
LANGUAGE
OPTIMIZATIONS
TARGETS
SEE ALSO
COPYRIGHT

GitHub

NAME

bcc - brainlet C compiler

SYNOPSIS

bcc

[-c|-i|-A|-S|-E] [-svwC] [-O olevel] [-o output] [-m mach_opt] [-I include_path] [-D name[=value]] [-U name] [-L directory] [-l library] source

bcc

[-V]

bcc

[-h]

DESCRIPTION

The bcc compiler is a small compiler for a C-like language. The language and the compiler are not fully complete and contain bugs. If no -c, -i, -A, -S or -E options are specified, bcc will try to link all generated object files into an executable.

OPTIONS

-o output

Specify the output file (or ’-’ for standard output). By default the output file is derived from the source file, except one of the -A or -E options was specified, then it is standard output.

-c

Compile and assemble the program.

-A

Only emit the abstract syntax tree of the program, as interpreted by the parser.

-i

Only emit the intermediate representation.

-S

Emit the assembly output.

-E

Only pre-process the file.

-O olevel

Specify the optimization level. (possible values: 0, 1, 2, 3)

-s

Strip all unnecessary information from the generated executable.

-v

Print verbose output.

-w

Disable all warnings.

-V

Print the version information.

-m mach_opt

Specify a target-dependend option.

-h

Print a simple help message.

-dumpmachine

Print the target machine.

-dumpversion

Print the version.

-dumparch

Print the target machine architecture.

-dumpmacros, -dM

Dump all predefined macros.

-nostdinc

Don’t search the default include paths.

-nostdlib

Same as -nostartfiles and -nolibc combined.

-nostartfiles

Don’t link against the crtX.o object files.

-nolibc

Don’t link against the C library.

-nobccobjs

Don’t link against the crt{begin,end}.o object files.

-static

Link the program with the static libc. (default)

-shared

Link the program with the shared libc. (unimplemented)

-save-temps

Don’t delete the generated temporary files.

-C

Suppress the color output.

-I include_path

Specify an include path for the preprocessor to search.

-D name[=value]

Specify a predefined macro.

-U name

Remove macro name

-L directory

Add directory to the search paths of the linker.

-l library

Tell the linker to link the executable against library.

-fpath-ld=LD

Specify the path to the linker.

-fpath-as=AS

Specify the path to the assembler.

-fpath-cpp=CPP

Specify the path to the pre-processor.

OPERANDS

output

The output file, to which to write the resulting output.

source

The source file, for which to generate the output.

olevel

The optimization level to perform. (default: 1)
Optimization levels 2 and below are considered "stable" and should not break the program.
Optimization level 3 is considered experimental and may be unsafe, therefore it is not recommended to use it.
An olevel of more than 3 has the same effect as level 3.

mach_opt

A target-specific option. For a list of all target-specific options issue bcc -mhelp.

include_path

A directory path which will be searched by the preprocessor for #include’s.

library

The name of a library to link with.

LANGUAGE

WIP
The compiler aims to implement a usable sub-set of the C99 standard, while changing some annoyance and adding a few extensions. Some of the changes break compatibility with the standard, this is intentional. The compiler does not support the full feature-set of neither C99 nor C90. But that was never the goal. This compiler was created as a learning project and as a successor to benc (an even worse compiler than this only available for 32-bit x86).
Changes/Extensions:
- do-while does not require a compound statement (eg. do f(); while (1); is valid).
- the pointer ’*’ is part of the type, instead of the name ( int* a; not int *a; ).
- added new basic type byte, which is guaranteed to be exactly 8 bits wide.
- parameter names of function implementations may be omitted. (eg. int add(int, int a) { return a; } ).
- added arraylen operator, which is similar to the sizeof operator. Instead it evaluates to the length in elements of the array.
- the auto keyword behaves as in C++11.
- function pointer types are now consistent (eg. int(int, int)* instead of int(*)(int, int) ).
- added typeof operator, which is similar to the sizeof operator. Instead it evaluates the type and returns a string(const char*).

OPTIMIZATIONS

Supported optimization techniques:
- constant folding (-O1)
- target-specific micro-optimizations (-O1)
- multiply to shift (-O1)
- dead-code elimination (-O1)
- constant evaluation of function call targets (-O1)
- experimental and/or unsafe optimizations (-O3)

TARGETS

Currently supported target architectures:
- i386
- x86_64
- riscv32
- riscv64
- arm

The compiler uses the System V ABI where applicable.
There is no multilib support; the compiler is installed for a single target-architecture. If a second target is wanted, the compiler must be rebuilt and reinstalled for the specific architecture.

SEE ALSO

bcpp(1), as(1), ld(1)

COPYRIGHT

Copyright © 2021 Benjamin Stürz
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


Generated using groff on 2021-12-10 07:56:41 (UTC)

Look at my source code on GitHub Memes
This website is licensed under the terms of the AGPLv3.
Tor link: 3gto4zix3cpwhq32sh5ygsr3brlmgy4pdf26md46e4zpzfzmbftw3cyd.onion