i'm trying to write a compiler code that read file of C++ code and check the Error's inside it . I need better Idea than what I Do . to check errors . .. just simple example for idea no more .this is my function of compile and have a wrong code but just I want share the ideas so that help me to make my code . because i lost .Thank you
public void Myfun1() { JFileChooser chooser = new JFileChooser(); chooser.showOpenDialog(null); File f =chooser.getSelectedFile(); String filename=f.getAbsolutePath(); BufferedReader br; try { br = new BufferedReader(new FileReader(filename)); String line; while ((line = br.readLine()) != null) { String[]sytanxError={"int" ,"float", "double" , "cin" , "cout"}; for(int i=0;i < sytanxError;++i) { if(line.equals(sytanxError)) { { } } } br.close(); } catch (FileNotFoundException ex) { Logger.getLogger(guiconcept.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(guiconcept.class.getName()).log(Level.SEVERE, null, ex); }