0

Ive been given this code as part of a lexical analyser for which i will be coding a syntax analyser - however the file the lexical analyser will be reading will come throught this code:

public static void main(String[] args) throws IOException
        {
        BufferedReader din = new BufferedReader(new  InputStreamReader(System.in)) ;
        System.err.print("file? ") ;
        System.err.flush() ;
        String fileName = din.readLine().trim() ;
        LexicalAnalyser lex = new LexicalAnalyser(fileName) ;
    } // end of class LexicalAnalyser

The thing is - where is the path name meant to go? It works by replacing fileName however im not so sure why my lecturer has coded the bufferedreader and inputstreamreader :S

Edited by Dani: Formatting fixed

3
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by jwenting
0

yup. What I find rather troublesome is that he uses System.err for non-error output...
It would be much preferred to read the inputfile through the commandline.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.