“Software is like entropy: It is difficult to grasp, weighs nothing, and obeys the Second Law of Thermodynamics; i.e., it always increases.”
— Norman Augustine

Welcome everyone, this is your host Nikhil Maan aka Sc0rpi0n101 and this week will be the last week of coding for GSoC 2019. It is time to finish work now.

The C Parser

I completed the C Parser last week along with the documentation for the module. Now, all that was left was improving tests and get the Travis Build passing. I wrote some new tests and modified the existing ones to ensure proper testing. The pull request was updated to test the Travis Build.

Travis Build

Travis CI

The Travis Build was passing initially, but only after installing the PyPI package explicitly. So, the first task regarding Travis for the week was to find a conda package that supported Clang’s Python bindings. Initially, the clang conda-forge package did not support python bindings. So, the plan was to create a conda-forge package for clang-python.

But, I soon discovered a conda package python-clang that supported clang’s python bindings. The build passed successfully passing all the tests with python-clang as an optional dependency.

The Pull Request was merged soon. You can check it out at []().



The tests for the parsers consist of 3 test files, one for each parser and another one for sym_expr.

  • test_sym_expr tests SymPyExpression
  • test_c_parser tests the C parser
  • test_fortran_parser tests the Fortran parser

The tests consist of parsing different chunks of C and Fortran source code and comparing the results with the expected SymPy Expression and testing the expression belongs to the correct AST Node. Expression comparison is a better and more robust testing method than using regex, which I was using initially.

The tests

src = 'integer :: a'
expr1.convert_to_expr(src, 'f')
ls = expr1.return_expr()
assert isinstance(ls[0], Declaration)
assert ls[0] == Declaration(
		type = IntBaseType(String('integer')),
		value = Integer(0)



I have made sure I documented all the modules properly. I wanted to make sure everyone else can understand and work with the module without any difficulty.

SymPyExpresion which will act as the Application Program Interface(API) is documented as per the needs of end-users. The docstrings explain how the parsers are supposed to be used. It consists of explanation and examples for the different methods of SymPyExpression.

The C and Fortran Parser modules have been documented as per the needs of developers. The docstrings consist of an explanation of how each visitor works, which functions handle what type of nodes, and how to use them.