-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="antlr-4.13.1-complete" level="project" /> | ||
</component> | ||
<component name="SonarLintModuleSettings"> | ||
<option name="uniqueId" value="eba85b9f-5565-43cd-9a19-32e1cfea9b44" /> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Operator:= | ||
Operator:= | ||
Handler:sendMessage | ||
Built-In: PRINT | ||
Operator:+ | ||
Operator:+ | ||
Operator:+ | ||
Operator:+ | ||
Built-In: PRIVATE | ||
Operator:= | ||
Operator:= | ||
Handler:receiveMessage | ||
Operator:= | ||
Operator:= | ||
Handler:observeMessage | ||
MAIN |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
% Actor communication where Actor X sends a message to Actor Y, and Actor Z observes this message | ||
|
||
Actor X { | ||
actorVars { | ||
string name; | ||
int id; | ||
} | ||
|
||
% Constructor | ||
X(string name, int id) { | ||
this.name = name; | ||
this.id = id; | ||
} | ||
|
||
% Method to send message to Y, observed by Z | ||
msgRcv sendMessage(string msgContent, ID receiver, ID observer) { | ||
print(name + " sends message to " + receiver + ": " + msgContent); | ||
|
||
% Send the message to Y’s queue as the recipient and Z’s queue as the observer | ||
receiver.receiveMessage(msgContent) @observers(private(observer, null)); | ||
} | ||
} | ||
|
||
Actor Y { | ||
actorVars { | ||
string name; | ||
int id; | ||
} | ||
|
||
% Constructor | ||
Y(string name, int id) { | ||
this.name = name; | ||
this.id = id; | ||
} | ||
|
||
% Handler to receive a message | ||
msgRcv receiveMessage(string msgContent) { | ||
} | ||
} | ||
|
||
Actor Z { | ||
actorVars { | ||
string name; | ||
int id; | ||
} | ||
|
||
% Constructor | ||
Z(string name, int id) { | ||
this.name = name; | ||
this.id = id; | ||
} | ||
|
||
% Observer handler to log observed messages | ||
msgRcv observeMessage(string msgContent) { | ||
} | ||
} | ||
|
||
main() { | ||
% Instantiation of actors X, Y, and Z | ||
X senderActor = new X("Alice", 101); | ||
Y receiverActor = new Y("Bob", 102); | ||
Z observerActor = new Z("Charlie", 103); | ||
|
||
% Alice sends message "Hello, Bob!" to Bob, observed by Charlie | ||
senderActor.sendMessage("Hello, Bob!", receiverActor, observerActor); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package main; | ||
|
||
import main.grammer.*; | ||
import org.antlr.v4.runtime.*; | ||
import org.antlr.v4.runtime.tree.*; | ||
import java.io.IOException; | ||
|
||
public class SOACT { | ||
public static void main(String[] args) throws IOException { | ||
CharStream reader = CharStreams.fromFileName(args[0]); | ||
SOACTLexer lexer = new SOACTLexer(reader); | ||
CommonTokenStream tokens = new CommonTokenStream(lexer); | ||
SOACTParser parser = new SOACTParser(tokens); | ||
ParseTree tree = parser.program(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
grammar SOACT; | ||
|
||
// Lexer rules | ||
// The lexer rules define patterns for recognizing tokens like numbers, booleans, strings, | ||
// comments, keywords, identifiers, and operators in the input text. These rules are used | ||
// by the lexer to break the input into a token stream. | ||
|
||
// TODO | ||
|
||
// Parser rules | ||
// The parser rules start with the program rule, which defines the overall structure of a | ||
// valid program. They then specify how tokens can be combined to form declarations, control | ||
// structures, expressions, assignments, function calls, and other constructs within a program. | ||
// The parser rules collectively define the syntax of the language. | ||
|
||
// TODO |