Prolog programs consist of a list of clauses and the grammar

Assignment Help Computer Engineering
Reference no: EM133660834

Compiler design subject

Part 1:

Question: 1

Recursive Descent

Prolog programs consist of a list of clauses and the grammar for a clause is the following where the terminals are

"," "(" ")" and ":-."

and we also let "x" denote the token for identifiers.

Clause -> Pred :- Body

Body -> Pred Body1
Body1 -> , Pred Body1

Body1 -> epsilon
Pred -> x ( Terms )

Terms -> Term Terms1

Terms1 -> , Term Terms1

Terms1 -> epsilon

Term -> x M

M -> (Terms)
M -> epsilon
S -> P

Question 2:  Find the firsts and follows for each non-terminal C,P,B,B1,T, T1, S where the terminals are:- , ( ) x

2) create the LL1 parsing table for this language and determine if this grammar can be used to parse Prolog by using Recursive Descent.

3) draw a parse tree for the following clause, where the identifiers, sibling, parent_child, X,Y, Z are all tokens of type "X"

sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y).

(Prolog programs consist of a set of logic statements, this one says the X and Y are siblings if they have a common parent, Z.)

Part 2:

Firsts and Follows-3

Consider the following grammar where P is the start symbol and the terminals are {$,a,b,c,d} and epsilon is the empty string.
P -> S $
S -> E T b
T -> a E F
T -> epsilon
E -> c
F -> d
F -> epsilon
For each non-terminal N (in P,S,T,E,F) find the First set and Follow set for N, that is
1) what are all of the terminals that can begin a string derived from N and
2) what are all the terminals that can follow N in a derivation from the start symbol, P.

Part 3: Draw this NFA.

RE2NFA-3

Convert the following Regular Expression into an NFA:

(a|b)* | (a|c* | (b|c)*

which is the language of a, b, c sequences which only have two of the three letters appearing. Don't try to optimize the NFA.

Submit your answer below along with a short movie explaining how you got your answer and why it is correct.

Reference no: EM133660834

Questions Cloud

What are theological implications of doctrine : What are the theological implications of the doctrine of the Bible, and how do they impact Christian belief and practice?
Who is the head of the house : Who is the head of the house? Who is in control in the marriage? How equal are marriages? What do you actually do when you exert power in a relationship?
Define juvenile delinquency : What kind of surroundings increase juveniles' delinquent behaviors? Are the causes different between today and 20 years ago?
Big seven in tech sector dominate market : Big Seven in Tech Sector Dominate Market Consider the elements of rhetorical context,
Prolog programs consist of a list of clauses and the grammar : create the LL1 parsing table for this language and determine if this grammar can be used to parse Prolog by using Recursive Descent
Discuss the expectations of a consumer of research : NUR 4165- Discuss the expectations of a consumer of research and share at least one way you are currently meeting that expectation as a working RN.
Garnered increased coverage by mainstream media : A significant reason that the issue of Missing and Murdered Indigenous Women (MMIW) garnered increased coverage by the mainstream media
Romantic comedies in her netflix recommendations : When you asked her why there were so many romantic comedies in her Netflix recommendations, your grandmother explained that Netflix looks at the movies
Discuss the importance of community recreation : Explain and discuss the importance of community recreation within ANY TWO of the following areas: Economic contribution of recreation.

Reviews

len3660834

3/18/2024 2:34:11 AM

Please start working on this assignment as soon as you can. This assignment counts a significant amount of my grade. this is a compiler design subject. Please assign it to someone who is experienced

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd