Git Product home page Git Product logo

ccompilerx's Introduction

DNA based chemical compiler - CCompiler X

This is an attempt to build a trans-compiler which can take C like code as input and generates chemical reactions XML file as output supported by CAIN. This XML file can be converted to Visual DSD supported file using CRN2DSD software developed at Gupta Lab. This compiler was developed as a part of my B.Tech project at DA-IICT in 2015.

If you use this work, please cite our paper: Shalin Shah, Manish Gupta. "DNA-based Chemical Compiler." arXiv preprint arXiv:1808.04790 (2018)

The compiler supports following operations :-

  • Addition
  • Subtraction (non-negative)
  • Multiplication
  • Identifier declaration

The compiler also supports following operation but is not able to generate code:-

  • Division
  • Conditional operators
  • 'if' branching statement
  • 'while' looping statement

The precedence and associativity of operator supported:-

Precedence Operator Associativity
1 *, / Left
2 +, - Left
3 >, <, >=, <=, ==, != Left

Required Libraries and Tools

  • uthash - Required for Hash Map.
  • flex - Required to tokenize source code i.e lexical analyzer part.
  • bison - Required to parse code as per Context Free Grammar i.e parser.
  • gdsl - Required to use data structure like stack, queue, etc.

Steps to build the source code

> bison -y -d parser.y
    
> flex lexer.l
    
> gcc -c y.tab.c lex.yy.c
    
> gcc y.tab.o lex.yy.o symbolTable.c genReaction.c extraModules.c treeParser.c -o ccx -I/usr/local/include/gdsl -L/usr/local/lib -lgdsl

For linking GDSL Lib

export LD_LIBRARY_PATH=/usr/local/include/gdsl:$LD_LIBRARY_PATH

Note: Confirm paths of GDSL flags after installing it in your UNIX system.

Error Handling

The compiler supports following kinds of error reporting:

  • Out of memory
  • Undeclared variable used
  • Incorrect Syntax

ccompilerx's People

Contributors

shalinshah1993 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

brezal z5476t4508

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.