Cancer-ravaged Penny Marshall is smoking up a storm, and medical experts warn it could dramatically cut what little time she has left.

But pals say the beloved comic actress is determined to go out HER way, and she intends to enjoy her vices till the bitter end.

“Penny has accepted the fact that she’s terminally ill, so she wants to live life to the max while she can,” a source reveals.

The former “Laverne & Shirley” star, 68, showed total disregard for her health by sucking on a cigarette while chatting on her cell phone in her car outside the Chateau Marmont in West Holly­wood on Dec. 10. “She’s smoking like a chimney and eating whatever she wants while she’s writing her memoirs. The only concession she’s made is that she now uses Tarblock filters on her smokes,” added the source.

The ENQUIRER was first to re­veal that Penny was diagnosed with a benign brain tumor and a malignant tumor on her liver in late 2009. The disease went into remission after extensive treatment, but Penny learned in October that the disease had spread to her lungs and is now stage 4, giving her just months to live.

With a death sentence hang­ing over her head, Pennyis gorging on her favorite foods and boozing it up, insiders say.

“When she’s hungry, Penny stuffs herself with bagels, pastrami, fet­tuccine alfredo and pizza,” confided another source. “She’s gained 40 pounds.

“She’s still getting chemo and anti-nausea pills, but she’s cut out all her other meds.

“Penny has told pals, ‘I’m on bor­rowed time as it is, so I might as well enjoy myself. Like Frank Sinatra said, I’m doing it my way!’”

But a pulmonary specialist warns that smoking could affect the quality of her remaining days.

“Smoking after receiving a cancer diagnosis is never beneficial,” said Dr. Samuel Jacobson of Boca Raton, Fla. “If you have lung cancer, smok­ing can cause further breathing problems and respiratory distress, thus aggravating the condition.”

Meanwhile, Penny is working furiously to finish her memoir: “My Mother Is Nuts,” insiders say.

“Penny is very sick, but she’s writing like a maniac,” divulged a third source. “All she wants to do is finish her book. She says that she’s never enjoyed a project more. It’s given her time to reflect on her truly wonderful life.

“She makes the most of her good days by visiting friends and spending time with her daughter Tracy’s family.

“But once the book is finished, Penny says she’s ready to go. She’s not afraid of death, and right now she’s concentrating on the joy of living.”