k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: "Park, Daejun" <dpark69 AT illinois.edu>
- To: "Dasgupta, Sandeep" <sdasgup3 AT illinois.edu>
- Cc: "k-user AT lists.cs.illinois.edu" <k-user AT lists.cs.illinois.edu>
- Subject: Re: [[K-user] ] Help Needed: Hex to String
- Date: Thu, 7 Dec 2017 19:28:56 +0000
- Accept-language: en-US
- Authentication-results: illinois.edu; spf=pass smtp.mailfrom=dpark69 AT illinois.edu
You can use `Id2String` or define your own using `STRING.token2string` hook as follows:
syntax String ::= HexConstant2String ( HexConstant ) [function, hook(STRING.token2string)]
Best,
Daejun
On Nov 27, 2017, at 5:02 PM, Sandeep Dasgupta <sdasgup3 AT illinois.edu> wrote:
Hello Team,
I would like to parse a hex constant like
```
syntax HexConstant ::= r"0x[0-9a-fA-F]*" [token]
```
and use the hook `STRING.string2base` to get the `Int` equivalent, like
```
syntax Int ::= HexStringtToInt(String, Int) [function, hook(STRING.string2base)]
rule convert(S:String) => HexStringtToInt(S, 16)
```
but for that i need the hex as String,
which I could not find how to get.
Can you guys please me with that?
Regards,
Sandeep
- Re: [[K-user] ] Help Needed: Hex to String, Park, Daejun, 12/07/2017
- Re: [[K-user] ] Help Needed: Hex to String, Sandeep Dasgupta, 12/07/2017
Archive powered by MHonArc 2.6.19.