Want to check whenever my command line value is x

In reply to zain_17501:

It would help to show the declarations of all variables used in your example
It would help to show the definition of the function ‘parse’ or at least explain what it does
Your $display statements do not match the output shown.