Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahriar-0 committed Nov 9, 2024
1 parent 9965929 commit 2ada2b9
Show file tree
Hide file tree
Showing 19 changed files with 347 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/antlr_4_13_1_complete.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

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.

3 changes: 3 additions & 0 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
3 changes: 3 additions & 0 deletions .idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions SOACT.iml
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>
16 changes: 16 additions & 0 deletions samples/sample.ans
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
66 changes: 66 additions & 0 deletions samples/sample.soc
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);
}
16 changes: 16 additions & 0 deletions src/main/SOACT.java
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();
}
}
16 changes: 16 additions & 0 deletions src/main/grammar/SOACT.g4
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

0 comments on commit 2ada2b9

Please sign in to comment.