Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and finish implementing trait preprocessing #4

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.build
.DS_store
tmp
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SEMANTICS_FILES ::= $(shell find rust-semantics/ -type f -name '*')
SEMANTICS_FILES ::= $(shell find rust-semantics/ -type f -a '(' -name '*.md' -or -name '*.k' ')')
RUST_KOMPILED ::= .build/rust-kompiled
RUST_TIMESTAMP ::= $(RUST_KOMPILED)/timestamp
SYNTAX_INPUT_DIR ::= tests/syntax
Expand Down
6 changes: 3 additions & 3 deletions rust-semantics/config.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
```k

module RUST-CONFIGURATION
imports RUST-INDEXING-CONFIGURATION
imports RUST-PREPROCESSING-CONFIGURATION

configuration
<rust>
<crate/>
<preprocessed/>
</rust>

endmodule

module RUST-RUNNING-CONFIGURATION
imports private RUST-INDEXING-SYNTAX
imports private RUST-PREPROCESSING-SYNTAX
imports RUST-CONFIGURATION

configuration
Expand Down
19 changes: 0 additions & 19 deletions rust-semantics/indexing.md

This file was deleted.

32 changes: 0 additions & 32 deletions rust-semantics/indexing/configuration.md

This file was deleted.

35 changes: 0 additions & 35 deletions rust-semantics/indexing/helpers.md

This file was deleted.

119 changes: 0 additions & 119 deletions rust-semantics/indexing/initialization.md

This file was deleted.

46 changes: 0 additions & 46 deletions rust-semantics/indexing/syntax.md

This file was deleted.

19 changes: 19 additions & 0 deletions rust-semantics/preprocessing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```k

requires "preprocessing/crate.md"
requires "preprocessing/configuration.md"
requires "preprocessing/helpers.md"
requires "preprocessing/initialization.md"
requires "preprocessing/syntax.md"
requires "preprocessing/trait.md"
requires "preprocessing/trait-methods.md"

module RUST-PREPROCESSING
imports private CRATE
imports private INITIALIZATION
imports private TRAIT
imports private TRAIT-METHODS
endmodule


```
34 changes: 34 additions & 0 deletions rust-semantics/preprocessing/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
```k

module RUST-PREPROCESSING-CONFIGURATION
imports private RUST-REPRESENTATION
imports private RUST-SHARED-SYNTAX

syntax Identifier ::= "my_identifier" [token]

configuration
<preprocessed>
<constants>
<constant multiplicity="*" type="Map">
<constant-name> my_identifier </constant-name>
<constant-value> tuple(.ValueList) </constant-value>
</constant>
</constants>
<traits>
<trait multiplicity="*" type="Map">
<trait-path> my_identifier:TypePath </trait-path>
<methods>
<method multiplicity="*" type="Map">
<method-name> my_identifier </method-name>
<method-params> .NormalizedFunctionParameterList </method-params>
<method-return-type> ():Type </method-return-type>
<method-implementation> empty:FunctionBodyRepresentation </method-implementation>
</method>
</methods>
</trait>
</traits>
</preprocessed>
endmodule


```
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module CRATE
imports private LIST
imports private MAP
imports private RUST-INDEXING-PRIVATE-SYNTAX
imports private RUST-INDEXING-SYNTAX
imports private RUST-PREPROCESSING-PRIVATE-SYNTAX
imports private RUST-PREPROCESSING-SYNTAX
imports private RUST-REPRESENTATION
imports private RUST-RUNNING-CONFIGURATION

Expand Down Expand Up @@ -67,11 +67,13 @@ module CRATE
, traitName : Name:Identifier
, traitFunctions: Functions:Map
)
=> crateInitializer
( ... constantNames: keys_list(Constants), constants: Constants
, traitName: Name
, functionNames:keys_list(Functions), functions: Functions
)
=> constantInitializer
( ... constantNames: keys_list(Constants), constants: Constants )
~> traitInitializer(Name)
~> traitMethodInitializer
( ... traitName: Name
, functionNames:keys_list(Functions), functions: Functions
)
endmodule

```
Loading
Loading