Directed Regular and Context-Free Languages