aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: a96972f297a2d3c5825078361135aab69ca2e3b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Amalgam
Amalgam is written in c89 C standard to work on as many devices as possible and with many different compilers,
which would allow you to compile amalgam with a compiler that generates smaller (static) binaries than gcc.

Amalgam is not meant to be a replacement for any other language but rather a new unique language for programming
with gpu without writing an external gpu program (glsl/hlsl).

Files have to be in utf-8 format and can optionally have utf-8 BOM.
# Fast compilation
Every stage of the compiler is multithreaded and data copy is kept to a minimal, for example tokenization
is done without storing tokens in a list. Almost all allocation is done using an arena allocator that
is only cleaned up once (when the compiler is finished), and the data is allocated sequentially.
# Dependencies
Right now only the C standard library (C89) is required for a release build. In the future dependency on the C standard library might be removed
and then amalgam would have 0 dependencies.\
python2 is needed for tests to run additional code analyzis.
# TODO
Build with -nostdlib and replace use of libc with syscalls (on linux).\
Don't parse files unless the variable they are assigned to (with @import) is used. This is useful when only using small parts of a library.
This could be done checking if an AST expression is referenced before evaluating it. There would then need to be a compile option
that compiles everything even if not referenced, since another user of the program/library may use the functions that are not used in your program
and they might have compile-issues.\
Align machine code to word boundary for the start of functions. No need to pad with NOP, as functions return before the padding.\
Use const to cleanup ANSI C style variable declarations, since const allows you to declare and assign variables on the same line.
# Documents
Documents are located under doc. The file doc/Documentation.md is generated from source files by running doc/doc_extract.py
but there is no need to run this script unless you are modifying documentation in the source.