Commit 05f97c02 authored by Sebastian Biewer's avatar Sebastian Biewer
Browse files

Fix issue #2, change build workflow to be npm linkable

parent 76caa7a0
......@@ -6,5 +6,6 @@ node_modules
temporary_files
ccs-interpreter-*.tgz
package
hidden_node_modules
*.DS_Store
......@@ -6,7 +6,8 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
tmp: ['temporary_files/']
tmp: ['temporary_files/'],
nodeModules: ['node_modules/']
},
coffee: {
CCSCompiler: {
......@@ -26,6 +27,22 @@ module.exports = function(grunt) {
dest: 'lib/CCSCompiler.js'
}
]
},
pseucoModulesIn: {
files: [
{
src: 'hidden_node_modules/',
dest: 'node_modules/@pseuco/'
}
]
},
pseucoModulesOut: {
files: [
{
dest: 'hidden_node_modules/',
src: 'node_modules/@pseuco/'
}
]
}
},
mkdir: {
......@@ -46,7 +63,7 @@ module.exports = function(grunt) {
});
grunt.loadNpmTasks('grunt-force-task');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-rename');
......@@ -54,10 +71,12 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('build', [
'rename:pseucoModulesIn',
'coffee',
'mkdir',
'rename',
'clean'
'rename:build',
'clean:tmp',
'rename:pseucoModulesOut'
]);
grunt.registerTask('test', ['mochaTest']);
grunt.registerTask('default', ['build', 'test']);
......
/* 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
/*
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/>.
*/
{
var rangeDefinitions = new Environment();
var autoProcessComplete = CCSStop;
}
start = C:CCS { return C; }
CCS
= PDefs:(Process/RangeDefinition)* _ System:Sequence _ !.
{
var defs = [];
for (var i = 0; i < PDefs.length; i++) {
if (PDefs[i])
defs.push(PDefs[i]);
}
return new CCS(defs, System).setCodePos(location().start.line,location().start.column);
}
RangeDefinition
= _ "range" _ id:name _ ":=" _ r:CoreRange _ { rangeDefinitions.setValue(id, r); return null; }
Process
= _ n:name _ params:("[" _ v:ValueIdentifier vs:(_ "," _ v2:ValueIdentifier { return v2; })* _ "]" _ { vs.unshift(v); return vs; } )? ":=" P:Sequence __ [\n\r]+
{
var res = new CCSProcessDefinition(n, P, params ? params : null, location().start.line).setCodePos(location().start.line,location().start.column);
return res;
}
Restriction
= _ P:Prefix res:(_ "\\" _ "{" as:(_ a1:(channel / "*") as2:(_ "," _ a2:channel { return a2; })* { as2.unshift(a1); return as2; } )? _ "}" { return (as) ? as : []; })?
{
res = res ? new CCSRestriction(P, res).setCodePos(location().start.line,location().start.column) : P;
//res.line = location().start.line;
return res;
}
Sequence
= _ P:Parallel Ps:(_ ";" Q:Parallel { return Q; })*
{
Ps.unshift(P);
while(Ps.length > 1){
var p = Ps.shift();
var q = Ps.shift();
Ps.unshift(new CCSSequence(p,q).setCodePos(location().start.line,location().start.column));
}
return Ps[0];
}
Parallel
= _ P:Choice Ps:(_ "|" Q:Choice { return Q; })*
{
Ps.unshift(P);
while(Ps.length > 1){
var p = Ps.shift();
var q = Ps.shift();
Ps.unshift(new CCSParallel(p,q).setCodePos(location().start.line,location().start.column));
}
return Ps[0];
}
Choice
= _ P:Restriction Ps:(_ "+" Q:Restriction { return Q; })*
{
Ps.unshift(P);
while(Ps.length > 1){
var p = Ps.shift();
var q = Ps.shift();
Ps.unshift(new CCSChoice(p,q).setCodePos(location().start.line,location().start.column));
}
return Ps[0];
}
Prefix
= Condition
/ _ A:(Match
/ Input
/ Output
/ SimpleAction ) P:PostPrefix?
{
return new CCSPrefix(A, P).setCodePos(location().start.line,location().start.column);
}
/ Trivial
Condition
= _ "when" _ "(" _ e:expression _ ")" _ P:Prefix
{
return new CCSCondition(e, P).setCodePos(location().start.line,location().start.column);
}
PostPrefix
//= &";" { return new CCSExit(); }
// (&";"/&"+"/&"|"/&"\\"/!.) { return new autoProcessComplete().setCodePos(location().start.line,location().start.column); }
= _ "." P:Prefix { return P; }
Match
= a:Action _ "?" _ "(" _ e:expression _ ")"
{
return new CCSMatch(a, e).setCodePos(location().start.line,location().start.column);
}
Input
= a:Action _ "?" v:(_ t:ValueIdentifier { return t; })?
{
return new CCSInput(a, v).setCodePos(location().start.line,location().start.column);
}
Output
= a:Action _ "!" e:(_ t:expression { return t; })?
{
return new CCSOutput(a, e ? e : null).setCodePos(location().start.line,location().start.column);
}
SimpleAction
= a:Action
{
return new CCSSimpleAction(a).setCodePos(location().start.line,location().start.column);
}
Action
= c:channel e:( "(" e:expression? ")" { return e; } )?
{
if (!e) e = null;
return new CCSChannel(c, e).setCodePos(location().start.line,location().start.column);
}
Trivial
= _ "(" P:Sequence _ ")" {
return P;
}
/ _ "0" {
return new CCSStop().setCodePos(location().start.line,location().start.column);
}
/ _ "1" {
return new CCSExit().setCodePos(location().start.line,location().start.column);
}
/ _ n:name
args:(_ "[" _ e:expression es:(_ "," _ e1:expression { return e1; })* _ "]" { es.unshift(e); return es; } )?
{
return new CCSProcessApplication(n, args).setCodePos(location().start.line,location().start.column);
}
name "name"
= first:[A-Z] rest:[$A-Za-z0-9_]* { return first + rest.join(''); }
// The following rules are the same, but they have different names which makes error messages better understandable!
identifier "identifier"
= first:[a-z_$] rest:[A-Za-z0-9_$]* { return first + rest.join(''); }
ValueIdentifier
= id:identifier __ r:(InlineRange)? { return new CCSVariable(id, r).setCodePos(location().start.line,location().start.column); }
InlineRange
= _ ":" _ r:CoreRange { return r; }
CoreRange
= a:int ".." b:int { return new CCSValueSet("number", a, b).setCodePos(location().start.line,location().start.column); }
/ a:("$"*) ".." b:("$"*) { return new CCSValueSet("string", a.length, b.length).setCodePos(location().start.line,location().start.column); }
/ id:name { return rangeDefinitions.getValue(id); }
channel "channel"
= first:[a-z] rest:[A-Za-z0-9_]* { return first + rest.join(''); }
/ '\u03c4' { return "i" }
/ '\ud835\uded5' {return "i" }
/ '\ud835\udf0f' { return "i" }
/ '\ud835\udf49' { return "i" }
/ '\ud835\udf83' { return "i" }
/ '\ud835\udfbd' { return "i" }
int "integer"
= "0" { return 0; }
/ first:[1-9] rest:[0-9]* { return parseInt(first + rest.join('')); }
// aexp "expression"
// = f:(int / action) r:(_ o:("+"/"-"/"*"/"/") _ s:(int/action) { return " " + o + " " + s })* { return f + r.join(""); }
//
// bexp "boolean expression"
// = f:(int / action) r:(_ o:("=="/"<"/"<="/">"/">="/"!=") _ s:(int/action) { return " " + o + " " + s })* { return f + r.join(""); }
_ "whitespace"
= [' '\n\r\t] _ {}
/ '#' inlineComment {}
/ '//' inlineComment {}
/ '(*' commentA _ {}
/ __ {}
__ "inline whitespace"
= ([' '\t] __ {}
/ '#' inlineCommentWhitespace {}
/ '//' inlineCommentWhitespace {}
/ '(*' commentA __ {})?