100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COP 4020 Final Exam Questions and Answers $12.49   Add to cart

Exam (elaborations)

COP 4020 Final Exam Questions and Answers

 0 view  0 purchase
  • Course
  • COP
  • Institution
  • COP

COP 4020 Final Exam Questions and Answers

Preview 2 out of 8  pages

  • November 15, 2024
  • 8
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • COP
  • COP
avatar-seller
lectknancy
COP 4020 Final Exam Questions and
Answers
Language design - Answer-computer languages allow humans to communicate
effectively in many domains,

Expressivity - Answer-why different languages are appropriate for different domains

Interpreters - Answer-directly executes instructions

(used for Perl, Python)

Compilers - Answer-converts programs to object code

(used for C, C++)

REPLs - Answer-Read, Evaluate, Print, Loops

(think Python environment)

lexical analysis - Answer-First phase of a compiler

Remove comments and identifying tokens in a sequence of characters

flex or re2c

Syntax analysis - Answer-Second phase of a compiler
Checks if the given input is in the correct syntax for the specific programming language

Semantic activities - Answer-Checks that the code has a meaningful sequence of
tokens

int a = "value";
lexically and syntactically correct, but it is an error because the type of assignment
differs.

Code generation - Answer-Last phase of a compiler,
Converts intermediate code to executable machine code.

Phases of compilation - Answer-1. Scanning (lexical analysis)
2. Parsing (syntax analysis)
3. Semantic analysis and intermediate code generation
4. Maybe some optimization
5. Target code generation

, 6. Code improvement on the final code (peephole
optimization)

Regex mechanisms - Answer-Concatenation (xy)
Alternation (x | y)
Repetition (aka Kleene closure)

Context-free grammar additional mechanism - Answer-Recursion

a(?R)?z to match "aaazzz"

Parser - Answer-a language recognizer.

Two types, LL and LR

LL parsers - Answer-top-down parsers (usually written by hand)
"Left-to-right, Left-most derivation"
recursive-descent parsing

LR parsers - Answer-bottom-up parsers (usually created with a parser generator)
"Left-to-right, Right-most derivation"

recursive-descent parsing - Answer-For each non-terminal, we write one function of the
same name

Each non-terminal is turned into a function call of that non-terminal's function, and each
terminal is made into a call for a match

If a production has alternatives, these alternatives must be distinguished by using the
predict set.

Recursive Descent - Answer-Each non-terminal becomes a function with the same
name

Each terminal is made into a call for a match

top-down parsing - Answer-a predictive form of parsing, such as recursive descent, in
which the parse tree of a statement is constructed starting at the root

bottom-up parsing - Answer-input words are matched against the right-hand sides of
grammar productions in an attempt to build the parse tree from leaves to root

parsing stacks - Answer-a top-down parser's stack contains a list of what the expects to
see in the future

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller lectknancy. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75759 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$12.49
  • (0)
  Add to cart