CC Assignment-1
CC Assignment-1
Sol-: An application written in Java must go through multiple steps of compilation. Here's
a quick rundown:
2. Compiling the Code: The Java compiler (javac) is used to build the Java source
code, resulting in bytecode (.class files).
3. Java Virtual Machine (JVM) and Bytecode: The machine cannot execute the
intermediate binary code that is created as bytecode directly. It is understood by the
Java Virtual Machine (JVM), which comprises a Java interpreter that transforms the
bytecode to the target computer machine code.
4.Execution: When the programme runs, the just-in-time (JIT) compiler transforms
the program's bytecode into machine code, which is subsequently executed.
The Java compilation process is run in two stages: first, in a virtual machine (JVM)
tailored for each operating system, and subsequently, through an OS-independent
compiler.
Using regular expressions to specify patterns and assigning actions to each pattern are
standard workflow steps. After that, Lex creates a programme that goes through the input,
finds these patterns, and starts the related processes. To create full compilers, Lex is
frequently used in conjunction with Yacc (Yet Another Compiler Compiler).
The syntax of the computer language is described by a context-free grammar that is defined
by the programmer in Yacc. The formation of various language constructions and their
relationships are outlined in the grammar rules. A parser that can identify the linguistic
constructions specified by the grammar is produced by Yacc.
Combining Yacc and Lex gives developers a strong toolkit for creating interpreters and
compilers. Tokenization and lexical analysis are handled by Lex, and syntactic analysis is
handled by Yacc. When combined, they make it easier to create compilers for programming
languages by streamlining the process of producing the parts required to process the source
code.
3. Construct a DFA for the following language over given alphabets and find its regular
expression.
A. L= { an bm c k|n , m, k ≥ 1}
' ' w
n a ( w )∧n b ( w ) is a number of a s∧no . of b s∈ ={a , b }}
Σ
a b c
→ q₀ ────→ qₐ ────→ qₐ
│ │ │
↓ ↓ ↓
│ │ │
└─────── ──────── ─┘
Floating-point literals in C can be represented in various forms, such as 1.0, 1e10, etc.
[0-9]*\.[0-9]+([eE][-+]?[0-9]+)?
This regular expression covers decimal points and the optional exponent part.
Character Literals:
Character literals are enclosed in single quotes, and they can represent a single character.
\'([^\']|(\\[\'"\\nrtbf0]))\'
This regular expression allows for escape sequences like \', \", \\, \n, \r, \t, \b, and \f.
String literals are enclosed in double quotes and can represent a sequence of characters.
\"([^\"]|(\\[\'"\\nrtbf0]))*\"
This regular expression allows for escape sequences similar to character literals.