mardi 4 août 2015

How to parse HEX Numbers in Bison

I have this project i'm suppose to work on and my first task is to build a deskCalculator. I want the calculator to be able to parse HEX numbers. Below is the section having the problem.

| HEX {$$ = strtol((char *)$1 , (char **)'\n', 16); }

A token HEX have been defined above and in the lex file the regular expresion have been defined as

hex [a-f0-9]+

The problem is at the level of the strtol function. Please Help me. Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire