https://github.com/steleman/fc
LLVM based Fortran frontend
https://github.com/steleman/fc
Last synced: 4 months ago
JSON representation
LLVM based Fortran frontend
- Host: GitHub
- URL: https://github.com/steleman/fc
- Owner: steleman
- License: bsd-2-clause
- Created: 2020-01-12T04:46:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T12:46:39.000Z (almost 7 years ago)
- Last Synced: 2025-12-03T18:59:49.064Z (8 months ago)
- Size: 344 KB
- Stars: 1
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# **FC - LLVM Based fortran frontend**
A new front end for Fortran has been written in the design spirit of LLVM/Clang. Approximately 20000 lines of code effort has got close to Fortran 95 standard. The Front end is complete end to end solution without semantic analysis. It compiles 400+ unit test cases and 2 SPEC CPU 2017 benchmarks.
### Dependencies
```
LLVM 7.0 - Can be built from source or prebuilt binaries can be used.
gfortran (for running unit tests)
```
## Build instructions
```
1. Set following environment variables
a. CLANG_BINARY=bin/clang
b. PATH=/bin:$PATH
c. LD_LIBRARY_PATH=/lib;$PATH
2. mkdir build && cd build
3. cmake -G Ninja -DLLVM_DIR=/lib/cmake/llvm/ ../fc -DCMAKE_INSTALL_PREFIX= -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
4. ninja install
5. ninja test
Note that clang-7.0 is already in your PATH. This will be used for building FC.
```
## Running HelloWorld
```
$ cat hello.f90
program hello
print *, "Hello world!"
end program hello
$ export CLANG_BINARY=/bin/clang
$ export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
$ /bin/fc hello.f90
$ ./a.out
Hello world!
```
## Running test
```
cd build
ctest
```
OR
```
cd build
ninja test
```
## Compiling input file to AST
```
fc -emit-ast
```
OR
```
fc -emit-ast -o
```
## Emitting LLVM IR
```
fc -emit-llvm
```
## Emitting LLVM BC
```
fc -emit-bc
```
## Fortran standard
Fortran standard can be specified via -std=f77 or -std=f95. If not specified standard is derived from file extension. Source files with ".f" are compiled to F77 standard and all other extensions are compiled to default standard.
### Enter following command for more options
```
fc --help
```
## Developed by
[CompilerTree Technologies](http://compilertree.com)