-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added support for Jolie language * added support for Jolie language * added samples for Jolie
- Loading branch information
Showing
11 changed files
with
262 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
include "types/Binding.iol" | ||
|
||
constants { | ||
Location_Exam = "socket://localhost:8000" | ||
} | ||
|
||
type StartExamRequest:void { | ||
.examName:string | ||
.studentName:string | ||
.student:Binding | ||
} | ||
|
||
type MakeQuestionRequest:void { | ||
.question:string | ||
.examName:string | ||
.studentName:string | ||
} | ||
|
||
type DecisionMessage:void { | ||
.studentName:string | ||
.examName:string | ||
} | ||
|
||
interface ExamInterface { | ||
OneWay: | ||
startExam(StartExamRequest), | ||
pass(DecisionMessage), fail(DecisionMessage) | ||
RequestResponse: | ||
makeQuestion(MakeQuestionRequest)(int) | ||
} | ||
|
||
interface StudentInterface { | ||
OneWay: | ||
sendMessage(string) | ||
RequestResponse: | ||
makeQuestion(MakeQuestionRequest)(int) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
include "common.iol" | ||
|
||
cset { | ||
studentName: | ||
StartExamRequest.studentName | ||
DecisionMessage.studentName | ||
MakeQuestionRequest.studentName, | ||
examName: | ||
StartExamRequest.examName | ||
DecisionMessage.examName | ||
MakeQuestionRequest.examName | ||
} | ||
|
||
execution { concurrent } | ||
|
||
outputPort Student { | ||
Interfaces: StudentInterface | ||
} | ||
|
||
inputPort ExamInput { | ||
Location: Location_Exam | ||
Protocol: sodep | ||
Interfaces: ExamInterface | ||
} | ||
|
||
main | ||
{ | ||
startExam( examRequest ); | ||
Student << examRequest.student; | ||
makeQuestion( question )( answer ) { | ||
makeQuestion@Student( question )( answer ) | ||
}; | ||
[ pass( message ) ] { | ||
sendMessage@Student( "You passed!" ) | ||
} | ||
[ fail( message ) ] { | ||
sendMessage@Student( "You failed!" ) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
include "common.iol" | ||
include "ui/swing_ui.iol" | ||
include "console.iol" | ||
|
||
outputPort Exam { | ||
Location: Location_Exam | ||
Protocol: sodep | ||
Interfaces: ExamInterface | ||
} | ||
|
||
main | ||
{ | ||
question.studentName = "John"; | ||
question.examName = "SPLG"; | ||
question.question = "Random question"; | ||
makeQuestion@Exam( question )( answer ); | ||
showYesNoQuestionDialog@SwingUI( "Do you want to accept answer " + answer + " ?" )( decision ); | ||
|
||
message.studentName = "John"; | ||
message.examName = "SPLG"; | ||
if ( decision == 0 ) { | ||
pass@Exam( message ) | ||
} else { | ||
fail@Exam( message ) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// https://github.com/jolie/website/blob/master/docs/documentation/locations/code/local.ol | ||
|
||
include "runtime.iol" | ||
include "string_utils.iol" | ||
|
||
type HanoiRequest: void{ | ||
.src: string | ||
.aux: string | ||
.dst: string | ||
.n: int | ||
.sid?: string | ||
} | ||
|
||
type HanoiReponse: void { | ||
.move?: string | ||
} | ||
|
||
interface LocalOperations{ | ||
RequestResponse: | ||
hanoiSolver( HanoiRequest )( HanoiReponse ) | ||
} | ||
|
||
interface ExternalOperations{ | ||
RequestResponse: | ||
hanoi( HanoiRequest )( string ) | ||
} | ||
|
||
outputPort Self{ | ||
Interfaces: LocalOperations | ||
} | ||
|
||
inputPort Self { | ||
Location: "local" | ||
Interfaces: LocalOperations | ||
} | ||
|
||
inputPort PowerService { | ||
Location: "socket://localhost:8000" | ||
Protocol: http{ | ||
.format = "html" | ||
} | ||
Interfaces: ExternalOperations | ||
} | ||
|
||
execution { concurrent } | ||
|
||
init | ||
{ | ||
getLocalLocation@Runtime()( Self.location ) | ||
} | ||
|
||
main | ||
{ | ||
[ hanoi( request )( response ){ | ||
getRandomUUID@StringUtils()(request.sid); | ||
hanoiSolver@Self( request )( subRes ); | ||
response = subRes.move | ||
}]{ nullProcess } | ||
|
||
[ hanoiSolver( request )( response ){ | ||
if ( request.n > 0 ){ | ||
subReq.n = request.n; | ||
subReq.n--; | ||
with( request ){ | ||
subReq.aux = .dst; | ||
subReq.dst = .aux; | ||
subReq.src = .src; | ||
subReq.sid = .sid | ||
}; | ||
hanoiSolver@Self( subReq )( response ); | ||
response.move += "<br>" + | ||
++global.counters.(request.sid) + | ||
") Move from " + request.src + | ||
" to " + request.dst + ";"; | ||
with ( request ){ | ||
subReq.src = .aux; | ||
subReq.aux = .src; | ||
subReq.dst = .dst | ||
}; | ||
hanoiSolver@Self( subReq )( subRes ); | ||
response.move += subRes.move | ||
} | ||
}]{ nullProcess } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
include "common.iol" | ||
include "ui/swing_ui.iol" | ||
include "console.iol" | ||
|
||
outputPort Exam { | ||
Location: Location_Exam | ||
Protocol: sodep | ||
Interfaces: ExamInterface | ||
} | ||
|
||
inputPort StudentInput { | ||
Location: "socket://localhost:8001/" | ||
Protocol: sodep | ||
Interfaces: StudentInterface | ||
} | ||
|
||
main | ||
{ | ||
request.studentName = "John"; | ||
request.examName = "SPLG"; | ||
request.student.location = "socket://localhost:8001/"; | ||
request.student.protocol = "sodep"; | ||
startExam@Exam( request ); | ||
makeQuestion( question )( answer ) { | ||
showYesNoQuestionDialog@SwingUI( question.question )( answer ) | ||
}; | ||
sendMessage( message ); | ||
println@Console( message )() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule language-jolie
added at
c0415b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
type: grammar | ||
name: language-jolie | ||
license: mit | ||
--- | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Fabrizio Montesi <famontesi@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |