Pt 164259596 generate format op (#10)

* Generate code for fate ops from spec.

* Generate the code from the makefile. Remove generated files.

* Test targets and cleanup.

* Spell eunit the right way.

* Use test target for ci.

* Renumber opcodes. Add primops.

* Generate tokens in scanner from definitions.

* Rename NUMBER op to GENERATION and add MICROBLOCK instruction.

* Since Tag < Size, Size cannot be zero

* unit is printed `()`

* Formatting differently

* Add eqc profile

* Generate code for fate ops from spec.

* Generate the code from the makefile. Remove generated files.

* Test targets and cleanup.

* Generate op pretty printer.

* Removed unused function.

* Polish Makefile file references (#11)

* Parse all types of values except variants.
This commit is contained in:
Erik Stenman
2019-02-28 19:18:25 +01:00
committed by GitHub
parent 8fc929b1ee
commit fccc570bee
12 changed files with 317 additions and 205 deletions
+3 -5
View File
@@ -128,7 +128,7 @@ serialize(L) when ?IS_FATE_LIST(L) ->
<<?LONG_LIST, Val/binary, Rest/binary>>
end;
serialize(Map) when ?IS_FATE_MAP(Map) ->
L = [{_K,_V}|_] = maps:to_list(?FATE_MAP_VALUE(Map)),
L = [{_K,_V}|_] = lists:sort(maps:to_list(?FATE_MAP_VALUE(Map))),
Size = length(L),
%% TODO: check all K same type, and all V same type
%% check K =/= map
@@ -136,10 +136,8 @@ serialize(Map) when ?IS_FATE_MAP(Map) ->
<<?MAP,
(rlp_integer(Size))/binary,
(Elements)/binary>>;
serialize(?FATE_VARIANT(Size, Tag, Values)) when 0 =< Size
, Size < 256
, 0 =< Tag
, Tag < Size ->
serialize(?FATE_VARIANT(Size, Tag, Values)) when 0 < Size, Size < 256,
0 =< Tag, Tag < Size ->
<<?VARIANT, Size:8, Tag:8,
(serialize(?FATE_TUPLE(Values)))/binary
>>.