56 56 votes The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense? Finite state automata Deterministic pushdown automata Non-deterministic pushdown automata Turing machine Compiler Design gatecse-2011 compiler-design lexical-analysis easy + – go_editor 20.7k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Gajanan Purud commented Sep 15, 2023 reply Follow flag A 0 0 replyShare vamsi_vinay commented 3 days ago i edited by vamsi_vinay 3 days ago reply Follow flag Finite automata cannot count . However, counting and structural balancing are tasks belongs to the Syntax Analysis (Parsing) phase of a compiler, not the Lexical Analysis phase. Finite automata , The only job of this phase is to break the raw stream of characters into individual, independent blocks called tokens (like keywords, identifiers, constants, and operators). Tokens can be completely defined using regular expressions (e.g., an identifier is just a letter followed by any combination of letters and digits). Because regular expressions map perfectly to Finite State Automata (FA), an FA is both necessary and fully sufficient here. Finite Automata :- Lexical Analysis CFL :- Syntax Analysis CSL / TM :- Semantic Analysis So , Option A. 0 0 replyShare Please log in or register to add a comment.
Best answer 82 82 votes Answer - A In compiler lexical analyzer categorizes character sequence into lexemes and produces tokens as output for parser. And tokens are expressed in regular expressions so a simple Finite Automata is sufficient for it. ankitrokdeonsns answered Nov 23, 2014 • edited Dec 4, 2017 by kenzou ankitrokdeonsns comment Share Follow See all 10 Comments 10 10 Comments reply Show 7 previous comments Ayush Upadhyaya commented Jan 8, 2019 reply Follow flag Tokens are recognized using a fixed set of rules called regular expressions.For each regulat expression, we can have a DFA.Hence FA is necessary and both sufficient. PDA and TM would be more than necessary. Power of PDA is needed in the syntax analysis phase. 3 3 replyShare rohith1001 commented Sep 26, 2019 reply Follow flag @talha hashim Lexical analysis=> DFA Syntax analysis=> PDA Semantic analysis=> Turing machine For semantic analysis LBA (which accepts CSL) would suffice. Semantic analysis checks for more meaningful things such as if a variable is declared before it's use, type checking etc. Turing machines are confined to only Theory. Correct me if I'm wrong. 2 2 replyShare Pvkarma commented Sep 18, 2020 reply Follow flag for lexical analysis we use finite automata 0 0 replyShare Please log in or register to add a comment.
5 5 votes During Lexical analysis,the tokens are recognized by FA.So a FA is necessary and sufficient vnc answered Nov 28, 2015 vnc comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes IN lexical phase we use dfa soo dfa = finite automata zgod answered Apr 4, 2025 zgod comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes https://testbook.com/question-answer/the-lexical-analysis-for-a-modern-computer-languag--60b604ae9105dcecbf97cefd Kundan_Kumar answered Feb 6 Kundan_Kumar comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Answer - A We use DFA for doing Lexical Analysis Complete_Analyzer answered Mar 31 Complete_Analyzer comment Share Follow 0 reply Please log in or register to add a comment.