The following article deals with questions/answers you may encounter when asked about Lexical and Syntax Analysis. Check the bottom of the page for links to the other questions and answers I’ve come up with to make you a great Computer Scientist (when it comes to Programming Languages).

324. What are the 3 approaches to implementing programming languages?

  • Compilation, Pure Interpretation and Hybrid Implementation

325. What is the job of the syntax analyzer?

  • Check the syntax of the program and create a parse tree.

326. What are the syntax analyzers based on?

  • Formal description of the syntax of programs, usually BNF.

327. What are some of the advantages of using BNF?

  • Descriptions are clear and concise.

  • Syntax analyzers can be generated directly from BNF.

  • Implementations based on BNF are easy to maintain.

328. What are the 2 distinct parts of syntax analysis and what do they do?

  • Lexical analysis: deals with small-scale language constructs such as name

  • Syntax analyzer: deals with large-scale constructs such as expressions

329. What are the 3 reasons for why lexical analysis is separated from syntax analysis?

  • Simplicity, Efficiency and Portability

330. What does the lexical analyzer do?

  • Collects input characters into groups (lexemes) and assigns an internal code (token) to each group.

331. How are lexemes recognized?

  • By matching the input against patterns.

#programming #programming-languages #computer-science-theory #computer-science #computer-science-student #data science

77 Programming Language Q&A (P4)
1.25 GEEK