The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
I can identify with the desk status - mine is layered in eras, the Jurassic being rather popular. If no one messes with it I can find things where I put them at any time.
However. No, let me put it this way: However !
My code is kept scrupulously organized - long before the term refactoring became popular I would do that as repetitive actions became apparent - cleaning up the inner workings. Comments, too, lest I forget. And, now producing web-based applications, I make sure the user interfaces are actually very few so that I don't sew unnecessary confusion amongst the rabble. Inside my machines, also organized and, withing certain limits, the same from box-to-box. Even in DOS times I used SUBST drives to force uniformity when it wasn't physically available.
Slash and burn - is best reserved for other people's code!
my code isn't inelegant. but yeah it's not for the faint of heart
(real world excerpt - not production ready)
publicstatic Lalr1ParseTable ToLalr1ParseTable(this CfgDocument cfg)
var start = cfg.GetAugmentedStartId(cfg.StartSymbol);
var pda = _ToLrfa(cfg);
var trnsCfg = _ToLRTransitionGrammar(cfg,pda);
var closure = new List<FA<string, ICollection<LRItem>>>();
var lalrclosure = new Lalr1ParseTable();
var itemSets = new List<ICollection<LRItem>>();
var i = 0;
foreach (var p in closure)
lalrclosure.Add(new Dictionary<string, (int RuleOrStateId, string Left, string Right)>());
i = 0;
foreach (var p in closure)
foreach (var trn in p.Transitions)
var idx = closure.IndexOf(trn.Value);
(idx, null, null)
foreach (var item in p.AcceptSymbol)
if (Equals(item.Rule.Left, start) && item.RightIndex == item.Rule.Right.Count)
(-1, null, null));
// work on our reductions nowvar map = new Dictionary<CfgRule, ICollection<string>>(_TransitionMergeRuleComparer.Default);
var follows = trnsCfg.FillFollows();
var rtbl = new List<IDictionary<object, CfgRule>>();
foreach (var rule in trnsCfg.Rules)
if (!map.TryGetValue(rule, out f))
elseforeach (var o in follows[rule.Left])
foreach (var me in map)
var rule = me.Key;
var lr = _LrtSymbol.Parse(rule.Right[rule.Right.Count - 1]);
var left = _LrtSymbol.Parse(rule.Left).Id;
var right = new List<string>();
foreach (var s in rule.Right)
var newRule = new CfgRule(left, right);
if (!Equals(left, start))
foreach (var f in me.Value)
// build the rule datavar rr = newstring[newRule.Right.Count];
for (var ri = 0; ri < rr.Length; ri++)
rr[ri] = newRule.Right[ri];
var iid = _LrtSymbol.Parse(f).Id;
(int RuleOrStateId, string Left, string Right) tuple;
var rid = cfg.Rules.IndexOf(newRule);
if (0> rid)
System.Diagnostics.Debugger.Break(); // couldn't find our rule// this gets rid of duplicate entries which seem to crop up in the table// TODO: I think this is a shift reduce conflict if it debugger-breaksif (lalrclosure[lr.To].TryGetValue(iid, out tuple))
if (rid != tuple.RuleOrStateId)
System.Diagnostics.Debugger.Break(); // possible shift-reduce conflice?
(rid, newRule.Left, rr));
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.