Skip to content

Commit

Permalink
Rename liblfort -> lfortran
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Dec 4, 2018
1 parent d11a21a commit fee449e
Show file tree
Hide file tree
Showing 50 changed files with 52 additions and 52 deletions.
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
build-gfortran
build-lfort
lfort_intrinsics.o
liblfort.a
liblfort/ast/ast.py
liblfort/parser/fortran.tokens
liblfort/parser/fortranLexer.py
liblfort/parser/fortranLexer.tokens
liblfort/parser/fortranParser.py
liblfort/parser/fortranVisitor.py
liblfortran.a
lfortran/ast/ast.py
lfortran/parser/fortran.tokens
lfortran/parser/fortranLexer.py
lfortran/parser/fortranLexer.tokens
lfortran/parser/fortranParser.py
lfortran/parser/fortranVisitor.py


# Python
Expand Down
12 changes: 6 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ full:
- ./build1.sh
- pip install .
- cd ..
- rm -r liblfort lfortran-${lfortran_version}
- rm -r lfortran lfortran-${lfortran_version}
- rm lfort
- py.test --pyargs liblfort
- py.test --pyargs lfortran
- python show_ast.py
- lfort examples/expr2.f90
- ./a.out
Expand All @@ -56,11 +56,11 @@ minimal:
- ./build1.sh
- pip install .
- cd ..
- rm -r liblfort lfortran-${lfortran_version}
- rm -r lfortran lfortran-${lfortran_version}
- rm lfort
- sudo apt-get remove -yq gcc libc6-dev
- sudo apt-get autoremove -yq
- py.test --pyargs liblfort
- py.test --pyargs lfortran
- lfort --ld-musl examples/expr2.f90
- ./a.out

Expand All @@ -75,12 +75,12 @@ jupyter:
- ./build1.sh
- pip install .
- cd ..
- rm -r liblfort lfortran-${lfortran_version}
- rm -r lfortran lfortran-${lfortran_version}
- (git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/lfortran/fortran_kernel && cd fortran_kernel && git checkout v0.1.3 && pip install . && cd .. && rm -r fortran_kernel)
- python -m fortran_kernel.install --sys-prefix
- jupyter kernelspec list --json
- cd share/lfortran/nb
- py.test --pyargs liblfort
- py.test --pyargs lfortran
- jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output Demo_out.ipynb Demo.ipynb
- ls -l output1.png
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Now the `lfortran` environment has the `lfort` compiler available.

Optional: run tests:
```
py.test --pyargs liblfort
py.test --pyargs lfortran
```


Expand Down
2 changes: 1 addition & 1 deletion build0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ python grammar/asdl_py.py

# Generate a parse tree from fortran.g4
antlr4="java org.antlr.v4.Tool"
(cd grammar; $antlr4 -Dlanguage=Python3 -no-listener -visitor fortran.g4 -o ../liblfort/parser)
(cd grammar; $antlr4 -Dlanguage=Python3 -no-listener -visitor fortran.g4 -o ../lfortran/parser)
8 changes: 4 additions & 4 deletions build1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ set -x
# Compile LFort runtime library
CFLAGS="-Wall -g -fPIC"
gcc $CFLAGS -o lfort_intrinsics.o -c lfort_intrinsics.c
ar rcs liblfort.a lfort_intrinsics.o
gcc -shared -o liblfort.so lfort_intrinsics.o
ar rcs liblfortran.a lfort_intrinsics.o
gcc -shared -o liblfortran.so lfort_intrinsics.o
mkdir -p share/lfortran/lib
mv liblfort.a share/lfortran/lib/
mv liblfort.so share/lfortran/lib/
mv liblfortran.a share/lfortran/lib/
mv liblfortran.so share/lfortran/lib/
4 changes: 2 additions & 2 deletions grammar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This directory contains the Fortran parse tree grammar (fortran.g4) and the
Fortran AST description (Fortran.asdl). The first is used by ANTLR4 to generate
a Python parser, the second is used by `asdl_py.py` to generate Python AST
classes and visitors. All generates files are written into the `liblfort`
classes and visitors. All generates files are written into the `lfortran`
module as Python files and once they are generated, this `grammar` directory is
not needed anymore and `liblfort` becomes just a regular Python library that
not needed anymore and `lfortran` becomes just a regular Python library that
has all the Python files it needs.
2 changes: 1 addition & 1 deletion grammar/asdl_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def main(argv):
print("Assuming default values of Fortran.asdl and ast.py")
here = os.path.dirname(__file__)
def_file = os.path.join(here, "Fortran.asdl")
out_file = os.path.join(here, "..", "liblfort", "ast", "ast.py")
out_file = os.path.join(here, "..", "lfortran", "ast", "ast.py")
else:
print("invalid arguments")
return 2
Expand Down
2 changes: 1 addition & 1 deletion lfort
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

from liblfort.liblfort import main
from lfortran.cli import main

if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.ast import ast
from lfortran.ast import ast

class CountNum(ast.GenericASTVisitor):

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.ast import parse, dump
from lfortran.ast import parse, dump

def test_dump_expr():
assert dump(parse("1+1", False)) == \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from glob import glob
import os

from liblfort.ast import parse
from lfortran.ast import parse

def test_files():
sources = [file1, file2, file3, file4, file5, file6, file7, file8, file9]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from liblfort.ast import parse, dump, SyntaxErrorException
from lfortran.ast import parse, dump, SyntaxErrorException

def to_tuple(t):
if t is None or isinstance(t, (str, int, complex)):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort import ast
from lfortran import ast

class SubroutinesVisitor(ast.ast.GenericASTVisitor):

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions liblfort/liblfort.py → lfortran/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def load_lfortran_runtime_library():
global _lfortran_runtime_library_loaded
if not _lfortran_runtime_library_loaded:
base_dir = get_lib_path()
liblfort_so = os.path.join(base_dir, "liblfort.so")
llvm.load_library_permanently(liblfort_so)
liblfortran_so = os.path.join(base_dir, "liblfortran.so")
llvm.load_library_permanently(liblfortran_so)
_lfortran_runtime_library_loaded = True

def main():
Expand Down Expand Up @@ -159,7 +159,7 @@ def main():
else:
# Invoke a C compiler to do the linking
base_dir = get_lib_path()
os.system("cc -o %s %s -L%s -Wl,-rpath=%s -llfort -lm" % (outfile,
os.system("cc -o %s %s -L%s -Wl,-rpath=%s -llfortran -lm" % (outfile,
objfile, base_dir, base_dir))
if objfile == "tmp_object_file.o":
os.system("rm %s" % objfile)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ..ast import parse, dump, SyntaxErrorException, ast
from ..semantic.analyze import SymbolTableVisitor, annotate_tree
from .gen import codegen
from ..liblfort import load_lfortran_runtime_library
from ..cli import load_lfortran_runtime_library


class FortranEvaluator(object):
Expand Down Expand Up @@ -190,4 +190,4 @@ def voidfn(self, name):
and of the correct signature, otherwise the behavior is undefined.
"""
fptr = CFUNCTYPE(None)(self.ee.get_function_address(name))
return fptr()
return fptr()
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.codegen.evaluator import FortranEvaluator
from lfortran.codegen.evaluator import FortranEvaluator

def test_arrays1():
e = FortranEvaluator()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.codegen.evaluator import FortranEvaluator
from lfortran.codegen.evaluator import FortranEvaluator

def test_do_loops_fn():
e = FortranEvaluator()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.codegen.evaluator import FortranEvaluator
from lfortran.codegen.evaluator import FortranEvaluator

def test_if_conditions():
e = FortranEvaluator()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.codegen.evaluator import FortranEvaluator
from lfortran.codegen.evaluator import FortranEvaluator

# Tests for FortranEvaluator

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.codegen.evaluator import FortranEvaluator
from lfortran.codegen.evaluator import FortranEvaluator

def test_intrinsics():
e = FortranEvaluator()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from liblfort.codegen.evaluator import LLVMEvaluator
from lfortran.codegen.evaluator import LLVMEvaluator

# Tests for LLVMEvaluator

Expand Down Expand Up @@ -234,7 +234,7 @@ def f(a, b):

def test_llvm_callback_stub():
from ctypes import c_int, c_void_p, CFUNCTYPE, cast
from liblfort.codegen.gen import create_callback_stub
from lfortran.codegen.gen import create_callback_stub
from llvmlite import ir
data = [0, 0]
ftype = CFUNCTYPE(c_int, c_int, c_int)
Expand All @@ -255,7 +255,7 @@ def f(a, b):
assert data == [2, 3]

def test_llvm_callback_py0():
from liblfort.codegen.gen import create_callback_py
from lfortran.codegen.gen import create_callback_py
from llvmlite import ir
data = [0]
def f():
Expand All @@ -273,7 +273,7 @@ def f():
assert stub() == 5

def test_llvm_callback_py2():
from liblfort.codegen.gen import create_callback_py
from lfortran.codegen.gen import create_callback_py
from llvmlite import ir
data = [0, 0]
def g(a, b):
Expand All @@ -290,7 +290,7 @@ def g(a, b):
assert data == [2, 3]

def test_llvm_callback_py3():
from liblfort.codegen.gen import create_callback_py
from lfortran.codegen.gen import create_callback_py
from llvmlite import ir
data = [0, 0, 0]
def f(a, b, c):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from liblfort.codegen.evaluator import FortranEvaluator
from lfortran.codegen.evaluator import FortranEvaluator

def test_fn_dummy():
e = FortranEvaluator()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest

from liblfort.semantic.analyze import (create_symbol_table, Integer, Real,
from lfortran.semantic.analyze import (create_symbol_table, Integer, Real,
Array, Logical, UndeclaredVariableError, annotate_tree, TypeMismatch)
from liblfort.ast import parse, dump
from lfortran.ast import parse, dump

def test_types():
r = Real()
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

import llvmlite.binding as llvm

from liblfort.ast import dump, SyntaxErrorException
from liblfort.codegen.evaluator import FortranEvaluator
from lfortran.ast import dump, SyntaxErrorException
from lfortran.codegen.evaluator import FortranEvaluator


def print_bold(text):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
data_files=[
('share/lfortran/nb', ['share/lfortran/nb/Demo.ipynb']),
('share/lfortran/lib', [
'share/lfortran/lib/liblfort.a',
'share/lfortran/lib/liblfort.so']),
'share/lfortran/lib/liblfortran.a',
'share/lfortran/lib/liblfortran.so']),
],
scripts=['lfort', 'prompt.py'],
classifiers=[
Expand Down
4 changes: 2 additions & 2 deletions show_ast.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from liblfort.ast import parse, dump
from liblfort.ast.tests.test_parser import to_tuple
from lfortran.ast import parse, dump
from lfortran.ast.tests.test_parser import to_tuple

source = open("examples/expr2.f90").read()
t = parse(source)
Expand Down

0 comments on commit fee449e

Please sign in to comment.