Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
3771b6a5f2 | |||
ec316d2a0d | |||
6c6bf38d8c | |||
9f90396023 | |||
f11697da1a | |||
fc2731fbbb | |||
cc76f93dd7 | |||
add82fe5ee |
1
Emakefile
Normal file
1
Emakefile
Normal file
@ -0,0 +1 @@
|
||||
{"src/*", [debug_info, {i, "include/"}, {outdir, "ebin/"}]}.
|
@ -8,6 +8,7 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
-module(aeso_aci).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([ file/2
|
||||
, file/3
|
||||
@ -222,16 +223,41 @@ do_render_aci_json(Json) ->
|
||||
case Json of
|
||||
JArray when is_list(JArray) -> JArray;
|
||||
JObject when is_map(JObject) -> [JObject];
|
||||
JText when is_binary(JText) ->
|
||||
case jsx:decode(Json, [{labels, atom}, return_maps]) of
|
||||
JArray when is_list(JArray) -> JArray;
|
||||
JObject when is_map(JObject) -> [JObject];
|
||||
_ -> error(bad_aci_json)
|
||||
end
|
||||
JText when is_binary(JText) -> decode(JText)
|
||||
end,
|
||||
DecodedContracts = [ decode_contract(C) || C <- Contracts ],
|
||||
{ok, list_to_binary(string:join(DecodedContracts, "\n"))}.
|
||||
|
||||
|
||||
decode(JSON) ->
|
||||
case code:is_loaded(jsx) of
|
||||
{file, _} ->
|
||||
case jsx:decode(JSON, [{labels, atom}, return_maps]) of
|
||||
JArray when is_list(JArray) -> JArray;
|
||||
JObject when is_map(JObject) -> [JObject];
|
||||
_ -> error(bad_aci_json)
|
||||
end;
|
||||
false ->
|
||||
case zj:binary_decode(JSON) of
|
||||
{ok, Decoded} when is_list(Decoded) -> atomize(Decoded);
|
||||
{ok, Decoded} when is_map(Decoded) -> [atomize(Decoded)];
|
||||
_ -> error(bad_aci_json)
|
||||
end
|
||||
end.
|
||||
|
||||
atomize(T) when is_map(T) ->
|
||||
maps:fold(fun atomize/3, #{}, T);
|
||||
atomize(T) when is_list(T) ->
|
||||
lists:map(fun atomize/1, T);
|
||||
atomize(T) ->
|
||||
T.
|
||||
|
||||
atomize(K, V, M) when is_binary(K) ->
|
||||
maps:put(binary_to_atom(K), atomize(V), M);
|
||||
atomize(K, V, M) ->
|
||||
maps:put(K, V, M).
|
||||
|
||||
|
||||
decode_contract(#{contract := #{name := Name,
|
||||
kind := Kind,
|
||||
payable := Payable,
|
||||
|
@ -1,4 +1,5 @@
|
||||
-module(aeso_ast).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([int/2,
|
||||
line/1,
|
||||
|
@ -11,6 +11,7 @@
|
||||
%%% instances of the compiler to be run in parallel.
|
||||
|
||||
-module(aeso_ast_infer_types).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([ infer/1
|
||||
, infer/2
|
||||
|
@ -8,6 +8,7 @@
|
||||
%%%
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_ast_to_fcode).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([ast_to_fcode/2, format_fexpr/1]).
|
||||
-export_type([fcode/0, fexpr/0, fun_def/0]).
|
||||
|
@ -7,6 +7,7 @@
|
||||
%%% Created : 12 Dec 2017
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_compiler).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([ file/1
|
||||
, file/2
|
||||
@ -27,7 +28,7 @@
|
||||
, validate_byte_code/3
|
||||
]).
|
||||
|
||||
-include_lib("aebytecode/include/aeb_opcodes.hrl").
|
||||
-include("$aebytecode_include/aeb_opcodes.hrl").
|
||||
-include("aeso_utils.hrl").
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
-module(aeso_errors).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-type src_file() :: no_file | iolist().
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
%%%
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_fcode_to_fate).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([compile/3, compile/4, term_to_fate/1, term_to_fate/2]).
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
%%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_parse_lib).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([parse/2,
|
||||
return/1, fail/0, fail/1, fail/2, map/2, bind/2,
|
||||
|
@ -3,6 +3,7 @@
|
||||
%%% Description :
|
||||
%%% Created : 1 Mar 2018 by Ulf Norell
|
||||
-module(aeso_parser).
|
||||
-vsn("8.0.1").
|
||||
-compile({no_auto_import,[map_get/2]}).
|
||||
|
||||
-export([string/1,
|
||||
|
@ -6,6 +6,7 @@
|
||||
%%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_pretty).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-import(prettypr, [text/1, sep/1, above/2, beside/2, nest/2, empty/0]).
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
%%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_scan).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([scan/1, utf8_encode/1]).
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
%%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_scan_lib).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([compile/1, string/3,
|
||||
token/1, token/2, symbol/0, skip/0,
|
||||
|
@ -9,9 +9,10 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
-module(aeso_stdlib).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([stdlib_include_path/0]).
|
||||
|
||||
stdlib_include_path() ->
|
||||
filename:join([code:priv_dir(aesophia), "stdlib"]).
|
||||
|
||||
{file, Path} = code:is_loaded(?MODULE),
|
||||
filename:join(filename:dirname(filename:dirname(Path)), "priv/stdlib").
|
||||
|
@ -7,6 +7,7 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
-module(aeso_syntax).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([get_ann/1, get_ann/2, get_ann/3, set_ann/2, qualify/2]).
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
%%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_syntax_utils).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([used_ids/1, used_ids/2, used_types/2, used/1]).
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
%%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(aeso_utils).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([scc/1, canonical_dir/1]).
|
||||
|
||||
|
@ -5,10 +5,11 @@
|
||||
%%%-------------------------------------------------------------------
|
||||
|
||||
-module(aeso_vm_decode).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-export([ from_fate/2 ]).
|
||||
|
||||
-include_lib("aebytecode/include/aeb_fate_data.hrl").
|
||||
-include("$aebytecode_include/aeb_fate_data.hrl").
|
||||
|
||||
-spec from_fate(aeso_syntax:type(), aeb_fate_data:fate_type()) -> aeso_syntax:expr().
|
||||
from_fate({id, _, "address"}, ?FATE_ADDRESS(Bin)) -> {account_pubkey, [], Bin};
|
||||
|
@ -1,4 +1,5 @@
|
||||
-module(aeso_warnings).
|
||||
-vsn("8.0.1").
|
||||
|
||||
-record(warn, { pos :: aeso_errors:pos()
|
||||
, message :: iolist()
|
||||
|
21
zomp.meta
Normal file
21
zomp.meta
Normal file
@ -0,0 +1,21 @@
|
||||
{name,"Sophia Compiler"}.
|
||||
{type,lib}.
|
||||
{modules,[]}.
|
||||
{prefix,none}.
|
||||
{desc,"The Sophia smart contract language for FATE blockchains"}.
|
||||
{author,"QPQ AG & Aeternity Foundation"}.
|
||||
{package_id,{"otpr","aesophia",{8,0,1}}}.
|
||||
{deps,[{"otpr","aebytecode",{3,2,1}},
|
||||
{"otpr","getopt",{1,0,2}},
|
||||
{"otpr","eblake2",{1,0,0}},
|
||||
{"otpr","zj",{1,1,0}}]}.
|
||||
{key_name,none}.
|
||||
{a_email,[]}.
|
||||
{c_email,[]}.
|
||||
{copyright,"(c) 2024 QPQ AG, 2018 Aeternity Foundation"}.
|
||||
{file_exts,[]}.
|
||||
{license,skip}.
|
||||
{repo_url,"https://gitlab.com/ioecs/aesophia"}.
|
||||
{tags,["gaju","gajumaru","blockchain","sophia","crypto","ae","compiler",
|
||||
"puck"]}.
|
||||
{ws_url,[]}.
|
19
zomp_prep
Executable file
19
zomp_prep
Executable file
@ -0,0 +1,19 @@
|
||||
#! /bin/bash
|
||||
|
||||
# This is a small pre-packaging source generation and include correction script that should be
|
||||
# run before packaging this project for use with ZX/Zomp.
|
||||
|
||||
rm -rf _build
|
||||
cd src
|
||||
for f in $(ls *.erl)
|
||||
do
|
||||
echo "Updating includes in: $f"
|
||||
sed -i 's/aebytecode\/include\///g' "$f"
|
||||
sed -i 's/\.\.\/include\///g' "$f"
|
||||
sed -i 's/include_lib/include/g' "$f"
|
||||
done
|
||||
sed -i 's/aeb_opcodes\.hrl/\$aebytecode_include\/aeb_opcodes\.hrl/' aeso_compiler.erl
|
||||
sed -i 's/aeb_fate_data\.hrl/\$aebytecode_include\/aeb_fate_data\.hrl/' aeso_vm_decode.erl
|
||||
cd ..
|
||||
rm -f ebin/*.beam
|
||||
rm -f rebar*
|
Loading…
x
Reference in New Issue
Block a user