using System.Text.RegularExpressions;
using System.Collections.Generic;
public static IEnumerable<string> Lines (string text) {
using (StringReader reader = new StringReader(text)) {
while ((line = reader.ReadLine()) != null) {
public static KeyValuePair<string,string> SplitToKeyValue(string text) {
Regex p = new Regex(@"^(\w+)\s+(.*)$");
return new KeyValuePair<string,string>(m.Groups[1].Value,m.Groups[2].Value);
public static void Main() {
string text = "LOAD =5.01E+10\r\nMPY $1\r\nADD $2";
LinkedList<KeyValuePair<string,string>> ll = new LinkedList<KeyValuePair<string,string>>(Lines(text).Select(SplitToKeyValue));
foreach(KeyValuePair<string,string> kvp in ll) {