A compiler translates (or compiles) a program written in a high-level programming language that is suitable for human pr

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

A compiler translates (or compiles) a program written in a high-level programming language that is suitable for human pr

Post by answerhappygod »

A compiler translates (or compiles) a program written in ahigh-level programming language that is suitable for humanprogrammers into the low-level machine language that is required bycomputers.
A lexical analysis stage that basically divides the input textinto a list of “words”. This is the initial part of reading andanalyzing the program text: The text is read and divided intotokens, each of which corresponds to a symbol in the programminglanguage, e.g., a variable name, keyword or number.
The next process will be a syntax analysis stage that analysesthe way these words form structures and converts the text into adata structure that reflects the textual structure.
The following set of rules that define for the syntax:
1) All statements will end in a semicolon.
2) Whitespace is not significant, i.e. a+b is the same as a +b.
3) Comments begin with /* and end with */ and they can extendacross multiple lines.
4) The only keywords are var, input, and output. Their functionis as follows: var declares a new variable. All variables must bedeclared before they're used. input reads a variable from theconsole. output displays the value of a variable on theconsole.
5) All variables are integers.
6) The only operations allowed are +, -, *, /, and =.Parentheses may be used to force operation ordering.
7) Variable names may only consist of uppercase and lowercaseletters, underscores (_), and numbers. A variable name may notstart with a number.
After the syntax analysis being performed the type checking,this phase analyses the syntax tree to determine if the programviolates certain consistency requirements, e.g., if a variable isused but not declared or if it is used in a context that does notmake sense given the type of the variable, such as trying to use aboolean value as a function pointer.
Design: invent a language, or a language fragment, for someparticular purpose or with some particular characteristic.
Modeling: try to formalize some interesting aspect of someexisting language Make sure that computations are sufficientlydocumented and supported by theories and literatures.
Implementation: explore novel techniques for implementing agiven language fragment
Take note in submitting the project:
1. May choose any two programming language. (C, C++, Java, C#,Python, etc) for implementation of the proposed project.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply