The Alphabet for any given programming language
That has every character and number:
Σ={0,1,2,...,9}∪{a,b,c,...,z}∪{A,B,C,...,Z}∪{+,-}
The RE for integer:
Regular Expression:
[0∪[1−9][0−9]*
The RE for floating integer:
Regular Expression:
([0∪[1−9][0−9]*)([0-9]∗ ∪ ϵ)
To make the dot (.) optional.
The RE for identifier:
([-∪[a-z])([a-z] ∪[0-9] ∪-)*
The RE for strings:
"( ^")∗"
where ^x= Σ *− Σ x
(complement).
The RE for new line:
"(^("∪ \n))*"
The RE for keywords:
if∪ else∪ for∪ while∪ function∪ int
The Relation Operation:
(== ∪ != ∪ <= ∪ >= ∪<∪ >)
Operator
([1-9][1-9]*) ∪ \*∪ % ∪ && ∪\ ∪! ∪ ^ ∪ &)