Question

1. Modern integrated development environments (IDEs) automatic code completion comple- tion, gives the programmer a list of

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) The parts of the compiler that would be needed to implement this functionality are:

(i) Lexical Analyzer: It reads and converts the program into tokens. It converts a lexeme stream into a stream of tokens. Tokens are defined by regular expressions understandable by the lexical analyzer. Lexical analyzer is also responsible for removing white-spaces and comments. Since, the autocomplete suggestions will be based on tokens preceding to the predicting test word, token generation i.e. the functionality of this phase is essential.

(ii) Parser( Syntax and Semantics analyzer): Parser constructs the parse tree. It takes all the tokens sequentially and construct the parse tree by using Context free grammar. The automation to represent the path for which predictable test word is generated here using parse tree, a parse Stack is also required to maintain the path to each automation transition. The automation can change state through epsilon transitions or null moves or when a certain token is received.

(b) Method calls are associated with object instances in an essential way, so the analysis phase can be changed by storing relevant function names in the lexical analyzer phase. The parse tree formation in syntax and semantics analysis need to be modified in order to accommodate method calls. In the middle-end, optimization of autocomplete suggestions can be performed by using data structures like tree.

Hope this helps.

Add a comment
Know the answer?
Add Answer to:
1. Modern integrated development environments (IDEs) "automatic code completion" comple- tion, gives the progra...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT