Skip to content

Lexical analyzer created from regular expressions

Notifications You must be signed in to change notification settings

Daligz/Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analyzer

Lexical analyzer created from regular expressions

Lexical-Analysis

About

Analyzer is a token recognition oriented lexical analyzer using regular expressions to check the rules of assigned grammatical structures.

Successful expression

successful-expression

Unsuccessful expression

unsuccessful-expression2 unsuccessful-expression1

Grammar

id + id - id = id + id - id / id

"id" represents alphanumeric values including decimals.

Expressions

Reserved words

  • int
  • flo
  • dou
  • boo
  • str
  • pub
  • class
  • print
  • true
  • false

Operations

  • "=="
  • ">="
  • "<="
  • "!="
  • "="
  • "!"
  • ">"
  • "<"
  • "+"
  • "-"
  • "/"
  • "%"
  • "&&"
  • "*"
  • ";"

Numbers

Reals and decimals

Lexical rules

  • An identifier cannot be called as a reserved word.
  • Expressions must end with a semicolon. (;)
  • Expressions cannot be put after the semicolon.
  • Identifiers cannot have numbers or special symbols.
  • Identifiers must be defined after their data type.
  • Identifiers must have at least one separating space with respect to their data type.
  • Operation expressions must be defined with only identifiers or numbers.
  • Odd operations cannot be performed on an expression.

Lexical analyzer process

lexical-analysis-process

About

Lexical analyzer created from regular expressions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages