So, how did my prediction on the pound do?

A year ago, I read an article in the Independent with the headline “Pound sterling slump: The key moments in six charts – and how low it could drop”, with the dire prediction:

Most economists expect the pressure on the pound to get worse, increasing the volatility across the broader market

At the time, the pound was at $1.24 against the dollar. Brexit, innit.

I had this to say about the sky falling:

Personally, I think Sterling will bottom shortly … on the basis that:

  1. it’s at a 35 year low
  2. the majority of economists expect the pressure on Sterling to continue.

I work on the simple premise that economists basically have no idea what they are talking about, so when they say things like “and it can only get worse”, you have a big contrarian indicator.

They say that nobody rings a bell at market bottoms … but, well, sometimes they kinda do … and the people ringing the bells are politicians, economists and experts. They may not necessarily sound like bells, but they are bells nevertheless.

So here’s the crunch question: did I call it right?

Well, GBP/USD is now $1.39, up from $1.24. So the answer is “yes”.

And how much money did I make on this brilliant insight of mine? Why, the same amount of money I made on the realisation that when Gordon Brown was selling off our gold, the gold market was likely at a bottom, of course. Which is to say, I made no money at all. C’est la vie.

I was right, though: politicians, economists, experts and alarmist headlines are often good contrarian indicators.

Stay safe out there.




Posted in Uncategorized | Leave a comment

MOSB – Moss Bros – the broader picture

MOSB (Moss Bros) issued a trading statement today, sending its shares down 15% to 76.4p. In one breath it said that it “continued to make progress”, but in another it refers to “lower footfall than anticipated”. The full year profit before tax is therefore expected to be slightly below current market expectations.

We are confident of our ability to continue to deliver enhanced returns to our shareholders

Sure. Whatever.

I am aware that some investors out there have made a lot of money in MOSB, so who am I to judge? Whenever I have taken a look at the numbers, I have always figured that MOSB is basically a “lifestyle business”. In other words, it brings in sufficient money to keep the directors and employees in gainful employment, but there’s really not much in it for investors. Perhaps if the directors were more skilled, the company fortunes would make a better showing.

To illustrate what I mean, MOSB reported revenues of £124m in 2003. For 2016, that figure was £128m. It has been bumping along at around those levels in between. It has even eliminated dividends.

Meanwhile, socks and pants retailer NXT (Next) has seen revenues rise from £2516m to £4097m. It has reduced its share count significantly, and its dividends per share has risen from 35p to 158p. That’s not to be sniffed at.

MOSB is on a PE of 15 (before today’s fall), which I would have thought was “high enough”. It pays a chunky dividend (which is uncovered, though), and has net cash. So there’s that. It has a Stockopedia StockRank of 91, but I’m finding it difficult to become excited about this share.

Just my 2 cents.

Stay safe out there.




Posted in Uncategorized | Leave a comment

CLLN – Carillion followup

Six months ago I wrote about CLLN (Carillion), and promised to do a follow-up. Hence this post.

I said this company should be avoided. Since then, the share price has fallen from 126p to 20.9p. I’m pleased to say that I called than one right. I notice that the shares are down 13% today.

A terrible company.

I wrote a small post about CLLN in August 2017, saying that in the trading statement of 29 September:

you ain’t gonna like what you’ll read

And indeed you wouldn’t. Although revenues were flat, net debt increased from £291m to £571m and

Full-year results to be lower than current market expectations

In their strategic review they note:

Business refocused on core strengths and markets

I’m going to be uncharitable and say that the business has no core strengths.

I also provided a link to John Kingham’s article “What you need to know to avoid the next Carillion” . It is worth reading.

Stay safe out there.


Posted in Uncategorized | Leave a comment

Follow-up on DEB and NXT; plus MTC

Six months ago, I wrote about hight-street retailers DEB (Debenham) and NXT (Next). I had made a note to myself to write a six months follow-up. Hence this post.

DEB was 42.75p, is now 29.56p.

NXT was 3890p, is now 4953p.

I was bearish on both of them. So I was half-right.

DEB seems to have gotten itself in a bit of a financial mess.I have always thought DEB merchandise to be too pricey.

MTC (Mothercare) announced its results today, causing its shares to drop 28%. Obviously not a good sign. I do not really see how MTC  has any reason to exist. Its UK L4L sales declined 7.2%. Its online sales also declined, as did international sales. It seems on a long, slow, painful decline to irrelevancy.

I just read that MTC has introduced in-store cafes. This is not new, though. The idea goes back to 2012. A quick Google revealed that in 2015, the Telegraph reported:

Mothercare scraps yoga studios to put in play areas

I recall that HMV introduced cafe stores in a bid to keep punters in the store longer. Perhaps setting up cafes in-store is a sign that a chain is reaching. Yoga studios seems just bizarre. It is a sure sign of utter desperation.

MTC must surely be toast. It’s just a question of time.


Posted in Uncategorized | Leave a comment

Magic Hat – SPO in, XLM out

The MHP (Magic Hat Portfolio) on Stockopedia ( is an experiment by me to see if a human can improve on a mechanical Greeblatt Magic Formula screen. I am trying to weed out “mistakes” that I feel the screening commits: unseasoned companies, scams, foreign companies (particularly Chinese), fishy accounting, and statistical quirks. Apart from that, I am agnostic as to the sector the company operates in, although I will try to avoid heavy concentration in any one sector. I will mostly apply “Strategic Ignorance”, by which I mean that I wont try to be clever in my stockpicking. My picking will be mostly mechanical. A summary of most of my Magic Hat articles can be found on the web page This will allow you to see, at a glance, what shares have been bought and sold in the past, as well as what shares have been rejected from consideration and why.

Happy new year to you all. Mr Market has been generous in 2017. The MHP has had a grand performance, returning 33%, as opposed to the market of 8%. Throughout its existence, the MHP has been chugging away outperforming the indices in a slow and steady manner. 2017 was an exceptional year for the portfolio, and I am inclined to put it down to a fluke. The outperformance for the bulk of the rest of its existence was far more modest.

According to StarCapital, the CAPE of UK at the end of September 2017 was 15.7. That is “about average”, maybe a little under. So we can be sanguine about the possible direction of the market. Unpredictable events may well determine the overall course of the market. We will only know these things with the benefit of hindsight.

The CAPE of the US markets is at an eye-watering 29. I see plenty of risk there. Russia, on the other hand, has a CAPE of 5.6. This valuation is absurdly low. I have been invested in JRS (JPM Russian Securities) for two years now, up 59% since I bought it. It has a dividend yield of 2.6%. Given the current valuations, I will continue to hold.

Emerging Europe as a sector is on a CAPE of 8.9, which looks good value to me. I have some shares in a couple of trusts that invest in this area.

Singapore, as a developed market, looks to be on safe valuations, with a CAPE of 12.9 and a PE of 11.0. It’s a pity that there aren’t any trusts that specialise in that country.

But back to the MHP …

XLM is kicked out by rotation, having returned 99%. Excellent. It has a Stockopedia StockRank of 90, so there would be no reason to sell in a panic. It has a pretty good chart, although its price is arguably overextended on its 50dMA, so a pull-back may be in order at this juncture.

Pool betting operator SPO (Sportech) enters the portfolio. It has a StockRank of 96. So let’s see how that pans out.

That’s all for this month. Stay safe out there.

Posted in Uncategorized | Leave a comment

My opinion on Damian Green

According to a recent BBC article (, Damien Green, described as one of the PM’s closest allies, has been sacked from the cabinet. An investigation found he breached ministerial code. The key issues seem to be:

  • the discovery of legal pornography on his computer, which appears to have been a direct breach of the code
  • an incident with Kate Maltby

I will start by saying that watching pornography is not immoral. You should not regulate or pry into people’s private, legitimate, affairs. As a public figure, he should, of course, expect greater scrutiny, and should conduct himself with more decorum than the general public. However, you have to draw the line somewhere, and seeings as his taste for pornography caused no public harm, I think it is wrong to vilify him.

Let’s be honest, sex is in itself a sordid, animalistic act, if you want to put it that way. It’s even more-so that pornography. After all, with pornography, you’re just looking. Should we therefore sack all people who have had sex? Of course not.

Let he who is without sin cast the first stone.

Next, we have the Kate Matlby thing:

The 31-year old [Kate] claimed the minister “fleetingly” touched her knee in a pub in 2015 and in 2016

Sorry Kate, but you’re going to have to come up with something more substantive than that if you want to ruin a man’s reputation.

The article continues:

sent her a “suggestive” text message which left her feeling “awkward, embarrassed and professionally compromised”.

OK, so what does that mean? Was it merely flirtatious, which she found unwelcoming; or was it predatory? There’s a difference.

Her statement is so vague and insinuating that, by itself, there is no reasonable grounds for censoring Green.

Here we run into the problem of “pussification of the west”. Adults are reduced to infants, unable to handle small trifles. It is narcissistic and self-entitled. It is an insidious evil – and make no mistake, it is an evil – where people are harmed merely by vague accusation or act of slight.

We now have policies of Zero Tolerance throughout the workplace.

Let us not forget some basic principles of law: de minimus non curat lex (the law does not concern itself with trifles) and culpae poenae par esto (the the punishment fit the crime).

You can see that Zero Tolerance, as an idea, doesn’t stack up well against principles that have been established over many centuries. Zero Tolerance lacks any leeway, the application of common sense and reason, judgement and a sense of proportionality; and really, a sense of justice. This is the legacy of Cultural Marxism. It is regressiveness parading at progressiveness. Political correctness gone haywire.
Great harm will come from this.

Update 21-Dec-2017: I’ve just seen a bit more on the BBC. Apparently, the chief cause of concern was the statements that Green made to the police about the possession of pornography. It seems that the possession itself was not the issue, nor was the matter with Kate. It seems that May’s hands were effectively tied on the issue (figuratively speaking, of course): lying to the police was a serious breach of the ministerial code which she could not allow to go unanswered. Although one does wonder as to why the police were snooping around Green’s laptop. So May’s actions seem justifiable, based on this reading.

Posted in Uncategorized | Leave a comment

Exploring byte-code compiler using #cplusplus


Let’s build a byte-code compiler.


There are several factors that have led me to writing “bcode”, my attempt at making a byte-code compiler:

  • my general interest in compiling technology
  • my involvement with neoleo, a spreadsheet that I forked from oleo, which is GNU’s spreadsheet program that has not been updated for many years. Part of the program parses user formulae, compiles and decompiles them into byte-codes as required. Lex and yacc are used. Oleo was originally written in C, and I was interested in converting it to C++. The workings of the compiler and parser were, and to some extent still are, a bit of a mystery to me. I figured that there must be a better way to do it.
  • my involvement with ultimc. Ultimc is a project that I created to work in conjunction with Ultibo, a unikernel for the RPi (Raspberry Pi). I figured that it would be nice to have a scripting environment for the unikernel, and set about creating Glute (“gluing utility”, although I like the name because it was vaguely rude). Although it currently “works”, it can only deal with commands. You cannot perform branching, or define functions.
  • I was inspired by Jack Crenshaw PhD’s series of articles, Let’s build a compiler to try my own take on the subject. Jack creates a compiler that spits out Motorola assembly. The assembly can then be compiled into an executable, assuming that you have access to the Motorola chipset
  • J.P. Bennett’s book “Introduction to compiling techniques – a first course using ANSI C, LEX and YACC” was of interest to me. I bought the book in 1996. I never made my way through all of it, although I occasionally dipped in, latterly more than formerly. I am glad I bought the book, as it is a pleasant introduction to compiling techniques.

Bennett’s work adopts the typical approach to writing a compiler:

  1. define a lexer using lex. He discusses ad hoc lexing techniques, where you basically roll-your-own lexer
  2. analyse the syntax using yacc. He also discusses top-down parsing.
  3. produce an intermediate representation of the compiled code. He chooses an idealised assembly language
  4. the idealised assembly language or intermediate code can then be compiled to native machine code. Bennett actually creates an interpreter for the assembly language, which is a perfectly reasonable choice.

Method of attack

I have this to say on compiler construction tools:

  • I would rather avoid code generation. Ideally, the code should just work, without any need for tool intervention. I think a lot of the drawbacks come from the limitations of C itself
  • they’re too complicated. This is a contentious point, I know. Everybody’s mileage varies on this. You have to learn them, and it’s difficult to know if they create more problems than they solve
  • the tools don’t especially fit harmoniously together. I always feel that it’s like trying to push two magnets together with the same polarity head-to-head. You can do it with sufficient force, but I would rather not.
  • they seem more designed to the C era of programming. I want to write in C++, where encapsulation is better, and I feel I have more certainty about computer memory hygiene (no leaks). I noticed that with neooleo, for example, it is difficult to reason about memory. I have ideas about how it could be better, although it is difficult to realise them given the nature of the tools I have

I think lex and yacc can be considered obsolete for the following reasons:

  • Rob Pike, of Go, Unix and Plan 9 fame, seems to prefer hand-rolled lexers
  • hand-rolled lexers are OK, but I think they require finnicky bookkeeping as to token state and the state of the input stream
  • if you don’t want to go down the lexing route, and hand-rolling a very low-level lexer is too much fiddle for you, and you are willing to sacrifice some efficiency, then you can use C++ regexs. By defining a list of them, and checking against them, you can effectively achieve what lex does, but without the hassle of using a separate tool. My blang project uses such an approach, and I think it completely obviates the need for lex
  • nearly all compiler writers today seem to use recursive descent compilers, having abandoned yacc.
  • recursive-descent compilers also fit in well with humans intuitvely

I have need of an interpreter, as opposed to a compiler. I am willing to sacrifice speed, and I am not looking to perform any optimsations. I had originally thought that a good idea would be to avoid writing any kind of byte-code compiler, and just walk through a parse tree as needed. I think it could be reasonably efficient. One of the real problems with compilers is that they rely on a lot of different “types”. Types include things like integers versus strings, or function blocks versus arithmetic. The compiler needs to work with variants of data types. This is commonly called ADTs (Abstract Data Types), or Sum Types. This is in contradistinction with Product Types, or more commonly called “the struct”. Product Types are widely supported in many languages. ADTs rarely feature in language designs. The notable expections are programming languages like Haskell, which excels at using ADTs. Lisp-like languages are also well-suited to ADTs, as they can deal with data representations dynamically. For a language like C++, it always felt like trying to put a square peg in a round hole. The latest version of C++ 17 does actually provide the variant type. Finally! As of writing (Dec 2017), full C++ compilers have not yet made their way into popular Linux distributions, though. I also wonder if C++’s solution is entirely satisfactory. It has chosen an object-oriented approach to dealing with variants, whereas I wonder if they would best be dealt with by syntactic extension. Time will tell.

Given the above factors, I am now think that byte-compiling is an idea that I want to explore. So my idea is that the parser, instead of constructing a parse tree, just spits out byte code. In Tcl, as the saying goes, “everything is a string”. It is a data-hiding mechanisem. I think it is a good approach for compilers, except that for “string”, read “series of bytes”.

So this is the approach I will adopt here:

  • instead of trying to compile a full-blown language, I will try to write a compiler for a simple assembly language. And I’m not kidding here, the parsing should be as simple as possible
  • that assembly will compile to byte-code for an “idealised” stack machine
  • the byte-codes will be interpreted

I think this is a good approach. You can compile a fully-fledged language by emitting those assembly instructions. The nature of writing a top-down parser is that you can generate assembly instructions in postfix form, and you do not have to construct a syntax tree. The tree is implicit in the top-down recursion. You don’t have to construct a tree explicitly. This is great, because it means that you don’t have to store variant-type intermediate structures, you just emit assembly code as you go, in the manner adopted by Crenshaw.

The code

I am trying to write my assembler piecemeal, creating features as we go. I do hope I make it to the end. So here are the parts:

Part 1 – halting, pushing and extensible execution, no branching



  • The above document above is available here.
  • For more details, see part 1, where I get into the instruction set and implement it in code. Branches are not yet implemented. I intend to work on them next.


Posted in Uncategorized | Leave a comment