Commit e27ace43 authored by Sebastian Biewer's avatar Sebastian Biewer

Removed files that I didn't want to commit

parent 05f97c02
/* global module:false */
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
CCS: {
src: [
'temporary_files/CCSParser.js',
'temporary_files/CCS_no_parser.js'
],
dest: 'temporary_files/CCS.js',
nonull: true
}
},
clean: {
tmp: ['temporary_files']
},
peg: {
CCS: {
src: 'src/CCSParser.pegjs',
dest: 'temporary_files/CCSParser.js',
options: {
exportVar: 'CCSParser'
}
}
},
coffee: {
CCS: {
options: {
bare: true
},
files: {
'temporary_files/CCS_no_parser.js': ['src/CCS.coffee', 'src/CCSRules.coffee', 'src/CCSExport.coffee']
}
}
},
rename: {
build: {
files: [
{
src: 'temporary_files/CCS.js',
dest: 'lib/CCS.js'
}
]
}
},
mkdir: {
bin: {
options: {
create: ['lib']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-peg');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.loadNpmTasks('grunt-mkdir');
grunt.registerTask('build', [
'peg',
'coffee',
'concat',
'mkdir',
'rename',
'clean'
]);
grunt.registerTask('default', ['build']);
};
\ No newline at end of file
CCS interpreter for pseuCo.com
===============
Author
-------
[Sebastian Biewer](https://depend.cs.uni-saarland.de/~biewer/)
License
-------
Copyright (c) 2013 - 2018
[Saarland University](https://www.uni-saarland.de)
[Dependable Systems and Software](https://depend.cs.uni-saarland.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Abstract
--------
For more information see [pseuCo.com](https://pseuco.com).
Usage
-----
This code is a submodule of pseuCo.com and can only be tested within pseuCo.com. You can find the source code and information regarding installation in [this repository](https://dgit.cs.uni-saarland.de/pseuco/concurrent-programming-web).
Credits
------
* [CoffeeScript](http://coffeescript.org) A language that compiles into JavaScript
* [PEG.js](http://pegjs.majda.cz) Parser generator
module.exports = require('./lib/CCS.js');
{
"_args": [
[
"@pseuco/ccs-interpreter@0.8.1",
"/Users/sebastian/Uni/Lehre/pseuco/pseuco-ccs-compiler"
]
],
"_from": "@pseuco/ccs-interpreter@0.8.1",
"_id": "@pseuco/ccs-interpreter@0.8.1",
"_inBundle": false,
"_integrity": "sha512-iKdcRsaJoXn3VF4FCwZUu4qKToZ+dbnSMFNFcoq6V0Utr0M+NcAoJiTiZ0e7NPPonNxpqdt59ylwbZ+ESLCxNA==",
"_location": "/@pseuco/ccs-interpreter",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@pseuco/ccs-interpreter@0.8.1",
"name": "@pseuco/ccs-interpreter",
"escapedName": "@pseuco%2fccs-interpreter",
"scope": "@pseuco",
"rawSpec": "0.8.1",
"saveSpec": null,
"fetchSpec": "0.8.1"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@pseuco/ccs-interpreter/-/ccs-interpreter-0.8.1.tgz",
"_spec": "0.8.1",
"_where": "/Users/sebastian/Uni/Lehre/pseuco/pseuco-ccs-compiler",
"author": {
"name": "Sebastian Biewer"
},
"bugs": {
"url": "https://dgit.cs.uni-saarland.de/pseuco/pseuco-ccs-interpreter/issues"
},
"description": "CCS interpreter for pseuco.com",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-coffee": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-rename": "^0.2.0",
"grunt-eslint": "^20.1.0",
"grunt-mkdir": "^1.0.0",
"grunt-peg": "^2.0.1"
},
"license": "GPL-3.0",
"main": "index.js",
"name": "@pseuco/ccs-interpreter",
"repository": {
"type": "git",
"url": "git://dgit.cs.uni-saarland.de:2222/pseuco/pseuco-ccs-interpreter.git"
},
"scripts": {
"prepack": "grunt"
},
"version": "0.8.1"
}
This diff is collapsed.
###
PseuCo Compiler
Copyright (C) 2013
Saarland University (www.uni-saarland.de)
Sebastian Biewer (biewer@splodge.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
###
exports = if module and module.exports then module.exports else {}
exports["parser"] = CCSParser
exports["internalChannelName"] = CCSInternalChannel
exports["exitChannelName"] = CCSExitChannel
exports["typeUnknown"] = CCSTypeUnknown
exports["typeChannel"] = CCSTypeChannel
exports["typeValue"] = CCSTypeValue
exports["getMostGeneralType"] = CCSGetMostGeneralType
exports["CCS"] = CCS
exports["ProcessDefinition"] = CCSProcessDefinition
exports["Process"] = CCSProcess
exports["Stop"] = CCSStop
exports["Exit"] = CCSExit
exports["ProcessApplication"] = CCSProcessApplication
exports["Prefix"] = CCSPrefix
exports["Condition"] = CCSCondition
exports["Choice"] = CCSChoice
exports["Parallel"] = CCSParallel
exports["Sequence"] = CCSSequence
exports["Restriction"] = CCSRestriction
exports["Channel"] = CCSChannel
exports["Action"] = CCSAction
exports["SimpleAction"] = CCSSimpleAction
exports["ValueSet"] = CCSValueSet
exports["Variable"] = CCSVariable
exports["Input"] = CCSInput
exports["Output"] = CCSOutput
exports["Match"] = CCSMatch
exports["CCSExpression"] = CCSExpression
exports["ConstantExpression"] = CCSConstantExpression
exports["VariableExpression"] = CCSVariableExpression
exports["ComplementExpression"] = CCSComplementExpression
exports["AdditiveExpression"] = CCSAdditiveExpression
exports["MultiplicativeExpression"] = CCSMultiplicativeExpression
exports["ConcatenatingExpression"] = CCSConcatenatingExpression
exports["RelationalExpression"] = CCSRelationalExpression
exports["EqualityExpression"] = CCSEqualityExpression
exports["AndExpression"] = CCSAndExpression
exports["OrExpression"] = CCSOrExpression
exports["actionSets"] = ActionSets
exports["Step"] = CCSStep
exports["BaseStep"] = CCSBaseStep
exports["PrefixRule"] = CCSPrefixRule
exports["OutputRule"] = CCSOutputRule
exports["InputRule"] = CCSInputRule
exports["MatchRule"] = CCSMatchRule
exports["ChoiceLRule"] = CCSChoiceLRule
exports["ChoiceRRule"] = CCSChoiceRRule
exports["ParLRule"] = CCSParLRule
exports["ParRRule"] = CCSParRRule
exports["SyncRule"] = CCSSyncRule
exports["ResRule"] = CCSResRule
exports["CondRule"] = CCSCondRule
exports["ExitRule"] = CCSExitRule
exports["SyncExitRule"] = CCSSyncExitRule
exports["Seq1Rule"] = CCSSeq1Rule
exports["Seq2Rule"] = CCSSeq2Rule
exports["RecRule"] = CCSRecRule
/* global module:false */
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
PseuCo: {
src: [
'temporary_files/PseuCoParser.js',
'temporary_files/PseuCo_no_parser.js'
],
dest: 'temporary_files/PseuCo.js',
nonull: true
}
},
clean: {
tmp: ['temporary_files/']
},
peg: {
PseuCo: {
src: 'PseuCoParser.pegjs',
dest: 'temporary_files/PseuCoParser.js',
options: {
exportVar: 'PseuCoParser'
}
}
},
coffee: {
PseuCo: {
options: {
bare: true
},
files: {
'temporary_files/PseuCo_no_parser.js': ['PseuCo.coffee', 'PCType.coffee', 'PCEnvironment.coffee', 'PCExport.coffee']
}
}
},
rename: {
build: {
files: [
{
src: 'temporary_files/PseuCo.js',
dest: 'lib/PseuCo.js'
}
]
}
},
mkdir: {
bin: {
options: {
create: ['lib']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-peg');
grunt.loadNpmTasks('grunt-contrib-rename');
grunt.loadNpmTasks('grunt-mkdir');
grunt.registerTask('build', [
'peg',
'coffee',
'concat',
'mkdir',
'rename',
'clean'
]);
grunt.registerTask('default', ['build']);
};
\ No newline at end of file
This diff is collapsed.
###
PseuCo Compiler
Copyright (C) 2013
Saarland University (www.uni-saarland.de)
Sebastian Biewer (biewer@splodge.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
###
exports = if module and module.exports then module.exports else {}
exports["parser"] = PseuCoParser
exports["EnvironmentController"] = PCTEnvironmentController
exports["EnvironmentNode"] = PCTEnvironmentNode
exports["Class"] = PCTClass
exports["Procedure"] = PCTProcedure
exports["Variable"] = PCTVariable
exports["Type"] = PCTType
exports["ArrayType"] = PCTArrayType
exports["ChannelType"] = PCTChannelType
exports["ClassType"] = PCTClassType
exports["ProcedureType"] = PCTProcedureType
exports["TypeType"] = PCTTypeType
exports["Node"] = PCNode
exports["Program"] = PCProgram
exports["MainAgent"] = PCMainAgent
exports["ProcedureDecl"] = PCProcedureDecl
exports["FormalParameter"] = PCFormalParameter
exports["Monitor"] = PCMonitor
exports["Struct"] = PCStruct
exports["ConditionDecl"] = PCConditionDecl
exports["Decl"] = PCDecl
exports["DeclStmt"] = PCDeclStmt
exports["VariableDeclarator"] = PCVariableDeclarator
exports["VariableInitializer"] = PCVariableInitializer
exports["ArrayTypeNode"] = PCArrayType
exports["BaseTypeNode"] = PCBaseType
exports["SimpleTypeNode"] = PCSimpleType
exports["ChannelTypeNode"] = PCChannelType
exports["ClassTypeNode"] = PCClassType
exports["Expression"] = PCExpression
exports["StartExpression"] = PCStartExpression
exports["AssignExpression"] = PCAssignExpression
exports["AssignDestination"] = PCAssignDestination
exports["SendExpression"] = PCSendExpression
exports["ConditionalExpression"] = PCConditionalExpression
exports["OrExpression"] = PCOrExpression
exports["AndExpression"] = PCAndExpression
exports["EqualityExpression"] = PCEqualityExpression
exports["RelationalExpression"] = PCRelationalExpression
exports["AdditiveExpression"] = PCAdditiveExpression
exports["MultiplicativeExpression"] = PCMultiplicativeExpression
exports["UnaryExpression"] = PCUnaryExpression
exports["PostfixExpression"] = PCPostfixExpression
exports["ReceiveExpression"] = PCReceiveExpression
exports["ProcedureCall"] = PCProcedureCall
exports["ClassCall"] = PCClassCall
exports["ArrayExpression"] = PCArrayExpression
exports["LiteralExpression"] = PCLiteralExpression
exports["IdentifierExpression"] = PCIdentifierExpression
exports["Statement"] = PCStatement
exports["BreakStmt"] = PCBreakStmt
exports["ContinueStmt"] = PCContinueStmt
exports["StmtBlock"] = PCStmtBlock
exports["StmtExpression"] = PCStmtExpression
exports["SelectStmt"] = PCSelectStmt
exports["Case"] = PCCase
exports["IfStmt"] = PCIfStmt
exports["WhileStmt"] = PCWhileStmt
exports["DoStmt"] = PCDoStmt
exports["ForStmt"] = PCForStmt
exports["ForInit"] = PCForInit
exports["ReturnStmt"] = PCReturnStmt
exports["PrimitiveStmt"] = PCPrimitiveStmt
exports["PrintStmt"] = PCPrintStmt
###
PseuCo Compiler
Copyright (C) 2013
Saarland University (www.uni-saarland.de)
Sebastian Biewer (biewer@splodge.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
###
###
This class represents PseuCo's types.
May be partly incomplete as type checking is not yet completely supported by the PseuCo tree.
###
class PCTType
constructor: (@kind) ->
throw ({"line" : 0, "column" : 0, "wholeFile" : true, "name" : "InvalidType", "message" : "Unknown kind of type!"}) if @kind < 0 || @kind > 14
isEqual: (type) ->
type.kind == @kind
isAssignableTo: (type) ->
return false if @kind is PCTType.WILDCARD
(@isEqual(type) or type.kind is PCTType.WILDCARD)
getBaseType: -> @
toString: ->
switch @kind
when PCTType.INT then "int"
when PCTType.BOOL then "bool"
when PCTType.STRING then "string"
when PCTType.CHANNEL then "channel"
when PCTType.ARRAY then "array"
when PCTType.MONITOR then "monitor"
when PCTType.STRUCTURE then "struct"
when PCTType.LOCK then "lock"
when PCTType.MUTEX then "mutex"
when PCTType.CONDITION then "condition"
when PCTType.PROCEDURE then "procedure"
when PCTType.TYPE then "type"
when PCTType.MAINAGENT then "mainAgent"
when PCTType.AGENT then "agent"
when PCTType.WILDCARD then "wildcard"
else "void"
PCTType.VOID = 0;
PCTType.BOOL = 1;
PCTType.INT = 2;
PCTType.STRING = 3;
PCTType.CHANNEL = 4;
PCTType.ARRAY = 5;
PCTType.MONITOR = 6;
PCTType.STRUCT = 7;
PCTType.LOCK = 8;
PCTType.MUTEX = 9;
PCTType.CONDITION = 10;
PCTType.PROCEDURE = 11;
PCTType.TYPE = 12;
PCTType.MAINAGENT = 13;
PCTType.AGENT = 14;
PCTType.WILDCARD = 15;
class PCTArrayType extends PCTType
constructor: (@elementsType, @capacity) ->
super PCTType.ARRAY
isEqual: (type) ->
capacityFulfilled = type.capacity == @capacity || @capacity == 0 || type.capacity == 0
type.kind == @kind and capacityFulfilled and @elementsType.isEqual(type.elementsType)
isAssignableTo: (type) ->
return false if @kind is PCTType.WILDCARD
(@elementsType.isAssignableTo(type.elementsType) or type.kind is PCTType.WILDCARD)
getBaseType: -> @elementsType.getBaseType()
toString: ->
parts = @elementsType.toString().split('[')
partsFront = [parts[0], "#{@capacity}]"]
parts = partsFront.concat parts[1..]
parts.join '['
class PCTChannelType extends PCTType
constructor: (@channelledType, @capacity) ->
super PCTType.CHANNEL
isEqual: (type) ->
@kind == type.kind and @capacity == type.capacity and @channelledType.isEqual(type.channelledType)
isAssignableTo: (type) -> # is this assignable to type?
@kind == type.kind and (@capacity == type.capacity or @capacity == PCChannelType.CAPACITY_UNKNOWN) and @channelledType.isEqual(type.channelledType)
getApplicableCapacity: -> if @capacity == PCChannelType.CAPACITY_UNKNOWN then 0 else @capacity
getBaseType: -> @channelledType.getBaseType()
toString: ->
if @capacity == PCChannelType.CAPACITY_UNKNOWN
"handshake #{@channelledType.toString()} #{super}"
else
"#{@channelledType.toString()} #{super} of capacity #{@capacity}"
class PCTClassType extends PCTType
constructor: (isMonitor, @identifier) ->
super (if isMonitor then PCTType.MONITOR else PCTType.STRUCT)
isMonitor: -> @kind == PCTType.MONITOR
isEqual: (type) ->
@kind == type.kind and @identifier == type.identifier
getBaseType: -> @
toString: -> "#{super} #{@identifier}"
class PCTProcedureType extends PCTType
constructor: (@returnType, @argumentTypes) ->
super PCTType.PROCEDURE
isEqual: (type) ->
return false if type.argumentTypes.length != @argumentTypes
(return false if not type.argumentTypes[i].isEqual(@argumentTypes[i])) for i in [0...@argumentTypes.length] by 1
type.returnType.isEqual(@returnType)
getBaseType: -> @returnType.getBaseType()
toString: ->
args = (t.toString() for t in @argumentTypes).join(" x ")
"#{@returnType.toString()} -> (#{args})"
class PCTTypeType extends PCTType
constructor: (@type) ->
super PCTType.TYPE