Hopeful little Charlie is poor in resources but rich in imagination: his way would suit a modest production in the sort of subsidised theatres where Greig usually works. "You'd do it with four actors and a ribbon," says the playwright. "And it would be wonderful." But Greig is actually currently working on a high-profile production funded by Warner Bros and directed by Sam Mendes – who was also responsible for the Bond movie Skyfall, which took over £700m worldwide. "In the West End," says Greig with a smile, "you've got to do it the Willy Wonka way."
Wonka is one of literature's great showmen: unconventional, brilliant, a little bit dangerous. His factory is an alternative universe in which fountains of chocolate flow from the ceiling, beings called Oompa-Loompas invent chewing gum flavoured like three-course meals, and squirrels are in charge of quality control. This kind of stuff is easy to conjure up from a page – but on stage? When Greig started working on the production five years ago, he was convinced it was "impossible". But Mendes reassured him: "Sam was really clear early on that he didn't want me to design it for him. He said, 'You write the story – we'll work out how we stage it.'"
Eating lunch in an Italian restaurant during a break from rehearsals (although the show opened in preview performances nearly a month ago, it's still being tweaked day by day), Greig gives every impression of finding the West End itself an alternative, magical universe. Scottish by birth (not something you'd guess from the soft English accent he acquired growing up in Nigeria), he usually lives in Fife, and has spent the past two decades making his name as a restlessly prolific writer, as happy producing musicals and work for children as he is complex political drama. It's the children's work, he thinks, that attracted Mendes: there was his inventive adaptation of Tintin in 2005; and Yellow Moon, a fierce story of troubled teenagers made for the National Theatre of Scotland in 2007, which transferred to New York. But it took him a long time to realise that Mendes and his team genuinely wanted to work with him: "They kept inviting me to meetings, but I'd think, 'Someone else is probably working on it, too.' It was very late on when I thought, 'I've got this job.'"
That's not just modesty: it's more that the collaboration with Mendes, and particularly the Broadway composer-lyricist Marc Shaiman and lyricist Scott Whitman, felt surprisingly playful. "I've read so many stories about fights and rows on Broadway, I was sort of expecting that. But it never happened. I'm not saying my bowels don't turn to water as we get close to properly opening [next week] – but as a process, it was actually very pleasant."
The trickiest part has been figuring out how to deliver scenes that children who know the book expect to see, while maintaining the surprise. Dahl's text is slyly gory: five children win the chance to tour the factory. Four meet a grisly fate: the greedy boy is swallowed up by a chocolate fountain, the demanding girl sent down a rubbish chute, and the children obsessed with chewing and TV are transmogrified by their bad habits. If Charlie survives unscathed, says Greig, it's because he represents our good side: "Deep down, the story is a reassurance that good will always win."
The same is true in that other great Dahl story doing big business in the West End: Matilda. Unloved by her parents, mistreated by her headteacher, Matilda has to work hard for her happy ending. But Greig argues that Matilda isn't straightforwardly good in the way Charlie is: actually, she's quite a naughty girl. He's keen to emphasise the differences between the children, because he knows that the two productions – just a few minutes' walk from each other – will be compared by critics and seen to be competing. "That's not helpful, but it's unavoidable," he says. "I can't deny that I didn't weep hot tears of jealousy at the brilliance of [adaptor] Dennis Kelly's work, and how wonderful a show it was. But trying to jump over a high bar isn't a bad thing. Even if you miss, it's still quite a high jump."
Greig says he couldn't have written Matilda himself, feeling more of an affinity with Charlie. Specifically, he sees himself as "Charlie with a dash of Matilda – there's good David and naughty David, and they both exist in my writing. In fact, when the writing is working well, there's a bit of a wrestle between them." Sometimes that lands Greig in trouble: in 2009, when a play of his set in Damascus toured to the Middle East, he was accused of trading in cultural stereotypes. The play, called Damascus, portrayed a Scottish salesman slowly realising the extent of his own cultural ignorance. It was intended by Greig as a satire on western liberal misconceptions, so he was horrified when he found himself being lambasted by audiences in Syria, furious that he had dared to misrepresent their society. "I realised that whenever I find myself in trouble, it's always good David who got me there. People were shouting, 'How dare you write about our city?' And a bit of me was thinking" – he puts a comic sob in his voice – "'I just wanted to understand!'"
Greig got in trouble again earlier this year, this time over a new play that hasn't even been staged yet. The Events, which will be at the Traverse during the Edinburgh fringe, provoked an outcry three months ago when newspapers reported that it was based on the Anders Breivik murders in 2011. Greig quickly clarified this: true, he went to Norway to interview people in Oslo and Utoya, but his subject isn't Breivik or other perpetrators of violence; it's people responding to that violence. At the heart of the play are a choir, who represent the grief and anger of a community, and a woman struggling to empathise with a murderer, known only as Boy. Her journey is similar to one Greig himself has been on since 9/11, trying to understand the actions of men whose political justifications for violence have always seemed to him unconvincing. He describes these violent men as "lost boys", seeing in their faces "this horrible lostness, this horrible vacuity".
Other acts of violence have occurred while he has been writing The Events: the bombing of the Boston marathon, the stabbing of soldier Lee Rigby in Woolwich. Greig has many questions about the way we respond to such events. "People often have a very deep, primal, moral reaction – that even speaking about that person is giving them too much attention," he says. "Then there's the instinct to punish, to string them up, to kill. I don't think that's very helpful. And I've started to wonder whether the instinct to understand could be destructive as well, because sometimes it's an impulse to control people."
Greig had a moment of insight while watching The Tempest at Shakespeare's Globe in London recently: "Caliban is another lost boy. And there's a brilliant line when Prospero says of him, 'This thing of darkness, I acknowledge mine.'" He wonders if people generally need to find a similar acceptance: not of violence, but the darkness within humanity that provokes it, which can never be satisfactorily punished or understood.
It seems odd that Greig should have been working on Charlie and The Events simultaneously: he jokes that he is going from "a project whose purpose is to delight thousands to a project whose purpose is to upset small numbers". He's always skittered between multiple works, though, and sometimes envies playwrights who have a more constant focus. "In some ways, they're the very best writers. It's like Chekhov and Brecht: you get the sense Chekhov nurtured his ideas, whereas Brecht was 'Try a bit of this, try a bit of that.' I'm definitely the latter type."
Greig started writing when struggling to make his way as a director, after studying English and Drama at Bristol University. He remains somewhat perplexed by the need he felt to be a Scottish rather than an English writer. Greig's extended family are from Aberdeen; he was born in Edinburgh and returned there at the age of 12, after a decade in Nigeria. Even so, he felt no particular connection with Scotland: he simply had "a visceral feeling that if I'm going to be a writer, I have to go back to Scotland. I couldn't intellectualise it, it was a physical impulse: if you're going to write, you need to be standing somewhere to speak."
He's now a visible force in Scottish theatre, particularly in debates around Creative Scotland: last year, he attacked the funding body for its lack of appreciation of Scottish artists, and its movement towards a more corporate model of funding work project by project. There is a strong political edge to his plays, too: from Dunsinane, his update of Macbeth, which satirised modern peacekeeping efforts in the Middle East, to the musical Glasgow Girls, which exposed the vagaries of British asylum policy. But if theatre has a social responsibility, he believes, it's not to educate but to entertain. People, particularly young people, need "more playfulness, more empathy, more entertainment and engagement that sees them as human souls, not as consumer products." So, in terms of social responsibility, what's his obligation with Charlie and the Chocolate Factory? He smiles. "To make sure people have a really fucking good time."
guardian.co.uk © Guardian News and Media Limited 2010
image: © John Loo