[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xsmith-dev] Random Function Name Generate Question



Hi all,

I'm trying to use XSmith to generate functions with different function names.

>From `3.6 Another Small Example With Variables` in the XSmith Doc, I think I need to use:

(add-to-grammar
     ....
    [Decl #f (name type)]
)

But I still don't understand how to `access` this `name`

What I want to do, is that I want to generate a program like:

fn main() { random_program_name() ; } fn random_program_name() -> givenType { return  73 * 7  ; }

Basically it has a function declaration (with a random name and given type) in main and then I could create a function with that random name and return type. Now I just hard code it.

I don't actually know how to describe my problem well, so I attached my program and add a `;;TODO` comment next to the lines I'm confusing, hope you could give me some suggestions on how to fix it.

Please let me know what can I do

Best,
Jack

Attachment: rustlang.rkt
Description: rustlang.rkt