Giter Site home page Giter Site logo

martinezlucas98 / java2cpp Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 4.0 914 KB

FLEX & BISON Java to C++ translator. NOTICE: it is still under development.

License: Apache License 2.0

Lex 1.23% Yacc 13.48% C 85.27% C++ 0.02%
lex flex yacc bison translator java cpp cool-stuff

java2cpp's Introduction

Hi , I'm Lucas Martínez

Currently pursuing a Master in CS at NYU. I like to Code, Design, Innovate and Experiment, and recently discovered my passion for AI and ML 🚀. I am an enthusiast for innovation and always up for new challenges!


C C++ Python Go JavaScript PostgreSQL Redis Git Notion Slack Docker Kubernetes

martinezlucas98

java2cpp's People

Contributors

joaquinecc avatar martinezlucas98 avatar shreegilliorkar avatar

Stargazers

 avatar

Watchers

 avatar  avatar

java2cpp's Issues

Implement Syntax Error

Implement Syntax Error

Description:
An error message must be printed when a syntax error occurs.
For now we will implement Panic-Mode Error Recovery. This can be upgraded in the future.

Implement print function grammar

Print function grammar

Description:

The most common function is the print function, this is a MUST HAVE for any translator.
The following grammars must be added:

  • System.out.println(expr); -----> std::cout << expr << std::endl;
  • System.out.print(expr); -----> std::cout << expr ;

Text input function grammar

Text input function grammar

Description:

The following translations are needed and must be added:

  • Scanner my_input = new Scanner(System.in); -----> string my_input; std::cin >> my_input;
  • my_input = new Scanner(System.in); -----> std::cin >> my_input;

Implement declaration of array

Required support for Java declarations:

  • double[ ] arr1 = new int[5];
  • int[ ] arr2 = {5,4,3,2,1};
  • double[ ][ ] arr3 = new int[3][5];
  • int[ ][ ] arr4 = {{1,2,3},{4,5,6},{7,8,9}};

Full support for the for loop

Full support for the for loop

Description:

java2cpp translator does not support for loop grammar at the moment. This grammar must be implemented.
The followings must be implemented:

  • 1. Classic C style for loop
  • 2. For-each loop

Implement while and do-while

Implement while and do while

Description:

The translator has no grammar for the while and do-while loops. These are major features that must be added.
The followings must be implemented:

  • 1. while loop grammar
  • 2. do while loop grammar

Implement symbol table and "variable not declared" error

Implement symbol table and "variable not declared" error

Description:
An error message must be printed when a "variable not declared" or "variable not declared in scope" error occurs.
For now we will implement Panic-Mode Error Recovery. This can be upgraded in the future.

Define method scope

Title

Description:

A clear description of the issue.
Describe the solution you'd like.
Describe alternatives you've considered.

Additional context:

Add any other context or screenshots about the feature request here.

Full support for the if-else statement

Full support for the if-else statement

Description:

java2cpp translator does not support if-else grammar at the moment. This grammar must be implemented.
The followings must be implemented:

  • 1. if-else grammar
  • 2. if-else if grammar
  • 3. if-else if - else grammar
  • 4. Embedded if-else statements

Accept and detect constant variables

Title

Description:

A clear description of the issue.
Describe the solution you'd like.
Describe alternatives you've considered.

Additional context:

Add any other context or screenshots about the feature request here.

Implement Type Error

Implement Type Error

Description:
An error message must be printed when a type error occurs.
For now we will implement Panic-Mode Error Recovery. This can be upgraded in the future.

Bug: variables are printed within [ ]

Bug: variables are printed within [ ]

Description:

When a variable is detected as part of an expression it is printed within [ ]

To Reproduce:

Steps to reproduce the behavior:

  1. Create a input file, for example testing.java as follows:
public class Main {
  public static void main(String[] args) {
    int a =3+6;
    int b = a+2;
  }
}
  1. Execute java2cpp
  2. Error - the translation results in:
int main(int argc, char **argv){
        int a = 3+6;
        int b = [a]+2;

}

Expected behavior:

The translation should be:

int main(int argc, char **argv){
        int a = 3+6;
        int b = a+2;

}

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.