Ethereum入門のSolidityのコードをver. 0.5.7でコンパイルする

book.ethereum-jp.net 入門としてよくまとまってるこれ、SolidityのコードがMacに普通にインストールしたコンパイラで動かなかったのでメモ
最初にコンパイルしようとしたところ

Error: Source file requires different compiler version (current compiler is 0.5.7+commit.6da8b019.Darwin.appleclang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.0;
^---------------------^

pragmaで怒られてしまった。ここを

pragma solidity >=0.4.0;

に変更してみる。
再度コンパイル

Error: The state mutability modifier "constant" was removed in version 0.5.0. Use "view" or "pure" instead.
    function get() public constant returns (uint retVal){
                          ^------^

なんかviewかpure使えと言われてるので、とりあえずview使う。

pragma solidity >=0.4.0;

contract SingleNumRegister {

    uint storedData;
    function set(uint x) public{
        storedData = x;
    }
    function get() public view returns (uint retVal){
        return storedData;
    }
}

こんなコードにしてコンパイル
とりあえずコンパイル通ってBinaryとContract JSON ABIが出力された。