KEMBAR78
Regular Expression | PDF
0% found this document useful (0 votes)
13 views1 page

Regular Expression

The document outlines the alphabet for a programming language, including characters, numbers, and operators. It provides regular expressions (RE) for integers, floating integers, identifiers, strings, new lines, and keywords. Additionally, it details relation operations and various operators used in the language.

Uploaded by

Yousef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Regular Expression

The document outlines the alphabet for a programming language, including characters, numbers, and operators. It provides regular expressions (RE) for integers, floating integers, identifiers, strings, new lines, and keywords. Additionally, it details relation operations and various operators used in the language.

Uploaded by

Yousef
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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]*) ∪ \*∪ % ∪ && ∪\ ∪! ∪ ^ ∪ &)

You might also like