for detailed differentiation of barrister and solicitor in BE of a clearer form than that offered by previous posters, see here:http://www.carrow.com/barri.html
reference to Bartleby regarding 'lawyer', see here:http://www.bartleby.com/61/70/L0077000.html
for attorney, see here:http://www.bartleby.com/61/14/A0511400.html
an attorney need not be a lawyer, and has no specific prosecutor/defender roles.
a lawyer is: One whose profession is to give legal advice and assistance to clients and represent them in court or in other legal matters,
- so that lawyers describe barristers, solicitors, and attorneys
barrister (roughly): in English legal systems, and those exported from England -
a courtroom lawyer, empowered to represent his client in higher courts.
solicitor (roughly): in English legal systems, and those exported from England - a legal professional advisor, who is empowered to represent his clients in lower courts.