Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Hand Coded Lexical Analyzer (Tokenizer)

Status
Not open for further replies.

LeafSy

Technical User
Jul 27, 2012
1
0
0
PH
I just want to ask how will i develop a Perl Lexical analyzer that will mimic language like C, for example the input will be:

main(){
printf("Hello World");
}

How will i broken down the input into tokens like main = reserve words, printf = function, ( = character symbol etc so that the output will be

reserveword_openparenthesis_closeparenthesis_opencurlybraces
function_openparenthesis_doublequote_stringConstants_doubleqoute_closeparenthesis_semicolon
closecurlybraces

I know the basic of perl like using regular expressions, I just dont know how will i break does lines of codes into tokens.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top