Skip to content

Commit

Permalink
Refactor parsing scripts (#91)
Browse files Browse the repository at this point in the history
* Refactor parsing scripts

* Fix dependency
  • Loading branch information
virgil-serbanuta authored Sep 23, 2024
1 parent 194c315 commit 246f9f8
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 61 deletions.
30 changes: 17 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,18 @@ $(PREPROCESSING_OUTPUT_DIR)/%.rs.preprocessed.kore: $(PREPROCESSING_INPUT_DIR)/%
$(EXECUTION_OUTPUT_DIR)/%.run.executed.kore: \
$(EXECUTION_INPUT_DIR)/%.run \
$(RUST_EXECUTION_TIMESTAMP) \
parse-rust.sh \
parse-test.sh
$(wildcard parsers/inc-*.sh) \
parsers/contract-rust.sh \
parsers/test-rust.sh
mkdir -p $(EXECUTION_OUTPUT_DIR)
krun \
"$(shell echo "$<" | sed 's/\.[^.]*.run$$//').rs" \
--definition $(RUST_EXECUTION_KOMPILED) \
--parser $(CURDIR)/parse-rust.sh \
--parser $(CURDIR)/parsers/contract-rust.sh \
--output kore \
--output-file $@.tmp \
-cTEST="$(shell cat $<)" \
-pTEST=$(CURDIR)/parse-test.sh
-pTEST=$(CURDIR)/parsers/test-rust.sh
cat $@.tmp | grep -q "Lbl'-LT-'k'-GT-'{}(dotk{}())"
mv -f $@.tmp $@

Expand All @@ -161,17 +162,18 @@ $(MX_TESTING_OUTPUT_DIR)/%.mx.executed.kore: $(MX_TESTING_INPUT_DIR)/%.mx $(MX_T
$(MX_RUST_TESTING_OUTPUT_DIR)/%.run.executed.kore: \
$(MX_RUST_TESTING_INPUT_DIR)/%.run \
$(MX_RUST_TESTING_TIMESTAMP) \
parse-mx-rust.sh \
parse-mx-rust-test.sh
$(wildcard parsers/inc-*.sh) \
parsers/contract-mx-rust.sh \
parsers/test-mx-rust.sh
mkdir -p $(MX_RUST_TESTING_OUTPUT_DIR)
krun \
"$(shell echo "$<" | sed 's/\.[^.]*.run$$//').rs" \
--definition $(MX_RUST_TESTING_KOMPILED) \
--parser $(CURDIR)/parse-mx-rust.sh \
--parser $(CURDIR)/parsers/contract-mx-rust.sh \
--output kore \
--output-file $@.tmp \
-cTEST='$(shell cat $<)' \
-pTEST=$(CURDIR)/parse-mx-rust-test.sh
-pTEST=$(CURDIR)/parsers/test-mx-rust.sh
cat $@.tmp | grep -q "Lbl'-LT-'k'-GT-'{}(dotk{}())"
mv -f $@.tmp $@

Expand All @@ -181,18 +183,20 @@ $(MX_RUST_TESTING_OUTPUT_DIR)/%.run.executed.kore: \
$(MX_RUST_CONTRACT_TESTING_OUTPUT_DIR)/%.run.executed.kore: \
$(MX_RUST_CONTRACT_TESTING_INPUT_DIR)/%.run \
$(MX_RUST_CONTRACT_TESTING_TIMESTAMP) \
parse-mx-rust-contract.sh \
parse-mx-rust-contract-test.sh
$(wildcard parsers/inc-*.sh) \
parsers/args-mx-rust-contract.sh \
parsers/contract-mx-rust-contract.sh \
parsers/test-mx-rust-contract.sh
mkdir -p $(MX_RUST_CONTRACT_TESTING_OUTPUT_DIR)
krun \
"$(shell echo "$<" | sed 's/\.[^.]*.run$$//').rs" \
--definition $(MX_RUST_CONTRACT_TESTING_KOMPILED) \
--parser $(CURDIR)/parse-mx-rust-contract.sh \
--parser $(CURDIR)/parsers/contract-mx-rust-contract.sh \
--output kore \
--output-file $@.tmp \
-cTEST='$(shell cat $<)' \
-pTEST=$(CURDIR)/parse-mx-rust-contract-test.sh \
-pTEST=$(CURDIR)/parsers/test-mx-rust-contract.sh \
-cARGS='$(shell cat $(patsubst %.run,%.args,$<))' \
-pARGS=$(CURDIR)/parse-mx-rust-contract-args.sh
-pARGS=$(CURDIR)/parsers/args-mx-rust-contract.sh
cat $@.tmp | grep -q "Lbl'-LT-'k'-GT-'{}(dotk{}())"
mv -f $@.tmp $@
8 changes: 0 additions & 8 deletions parse-mx-rust-contract-args.sh

This file was deleted.

8 changes: 0 additions & 8 deletions parse-mx-rust-contract-test.sh

This file was deleted.

8 changes: 0 additions & 8 deletions parse-mx-rust-contract.sh

This file was deleted.

8 changes: 0 additions & 8 deletions parse-mx-rust-test.sh

This file was deleted.

8 changes: 0 additions & 8 deletions parse-mx-rust.sh

This file was deleted.

8 changes: 0 additions & 8 deletions parse-rust.sh

This file was deleted.

5 changes: 5 additions & 0 deletions parsers/args-mx-rust-contract.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

source ${BASH_SOURCE%/*}/inc-endpoint-args-file.sh

parse_endpoint_args .build/mx-rust-contract-testing-kompiled $1
5 changes: 5 additions & 0 deletions parsers/contract-mx-rust-contract.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

source ${BASH_SOURCE%/*}/inc-contract-file.sh

parse_rust .build/mx-rust-contract-testing-kompiled $1
5 changes: 5 additions & 0 deletions parsers/contract-mx-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

source ${BASH_SOURCE%/*}/inc-contract-file.sh

parse_rust .build/mx-rust-testing-kompiled $1
5 changes: 5 additions & 0 deletions parsers/contract-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

source ${BASH_SOURCE%/*}/inc-contract-file.sh

parse_rust .build/rust-execution-kompiled $1
8 changes: 8 additions & 0 deletions parsers/inc-contract-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function parse_rust() {
kast \
--output kore \
--definition $1 \
--module RUST-COMMON-SYNTAX \
--sort Crate \
$2
}
8 changes: 8 additions & 0 deletions parsers/inc-endpoint-args-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function parse_endpoint_args() {
kast \
--output kore \
--definition $1 \
--module MX-RUST-SYNTAX \
--sort MxValueList \
$2
}
8 changes: 8 additions & 0 deletions parsers/inc-test-mx-rust-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function parse_test() {
kast \
--output kore \
--definition $1 \
--module MX-RUST-SYNTAX \
--sort MxRustTest \
$2
}
5 changes: 5 additions & 0 deletions parsers/test-mx-rust-contract.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

source ${BASH_SOURCE%/*}/inc-test-mx-rust-file.sh

parse_test .build/mx-rust-contract-testing-kompiled $1
5 changes: 5 additions & 0 deletions parsers/test-mx-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/bash

source ${BASH_SOURCE%/*}/inc-test-mx-rust-file.sh

parse_test .build/mx-rust-testing-kompiled $1
File renamed without changes.

0 comments on commit 246f9f8

Please sign in to comment.