Skip to content

Commit

Permalink
proper directory/module structure
Browse files Browse the repository at this point in the history
  • Loading branch information
grammarware committed Jun 1, 2012
1 parent 98cdd59 commit 2ed2dbd
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 47 deletions.
2 changes: 1 addition & 1 deletion shared/rascal/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>xbgf</name>
<name>slps</name>
<comment></comment>
<projects>
</projects>
Expand Down
2 changes: 1 addition & 1 deletion shared/rascal/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: xbgf
Bundle-SymbolicName: xbgf
Bundle-SymbolicName: slps
Bundle-Version: 1.0.0
Require-Bundle: org.eclipse.imp.pdb.values,
rascal
Expand Down
1 change: 1 addition & 0 deletions shared/rascal/README.txt
@@ -0,0 +1 @@
this directory contains a Rascal Project called "slps"
26 changes: 26 additions & 0 deletions shared/rascal/src/Main.rsc
@@ -0,0 +1,26 @@
@contributor{Vadim Zaytsev - vadim@grammarware.net - CWI}
module Main

import IO;
import syntax::BGF;
import syntax::XBGF;
import io::ReadXBGF;
//import lang::xml::DOM;

public void main()
{
println(readXBGF(|project://slps/tests/undefine1.xbgf|));
}

public bool tryAll()
{
loc base = |project://slps/tests|;
for (f <- listEntries(base))
{
if (f == ".gitignore") continue;
println(f);
println(readXBGF(base+f));
}
return true;
}

23 changes: 3 additions & 20 deletions shared/rascal/src/XBGF.rsc → shared/rascal/src/io/ReadXBGF.rsc
@@ -1,28 +1,11 @@
@contributor{Vadim Zaytsev - vadim@grammarware.net - CWI}
module XBGF
module io::ReadXBGF

import IO;
import XBGFSyntax;
import syntax::BGF;
import syntax::XBGF;
import lang::xml::DOM;

public void main()
{
println(readXBGF(|project://xbgf/tests/undefine1.xbgf|));
}

public bool tryAll()
{
loc base = |project://xbgf/tests|;
for (f <- listEntries(base))
{
if (f == ".gitignore") continue;
println(f);
println(readXBGF(base+f));
}
return true;
}


public XBGFSequence readXBGF(loc f)
{
Node N = parseXMLDOMTrim(readFile(f));
Expand Down
26 changes: 26 additions & 0 deletions shared/rascal/src/syntax/BGF.rsc
@@ -0,0 +1,26 @@
@contributor{Vadim Zaytsev - vadim@grammarware.net - CWI}
module syntax::BGF

data BGFProduction =
production (str label, str lhs, BGFExpression rhs)
;

data BGFExpression =
epsilon()
| empty()
| val(BGFValue v)
| anything()
| terminal(str t)
| nonterminal(str t)
| selectable(str selector, BGFExpression expr)
| sequence(list[BGFExpression] exprs)
| choice(list[BGFExpression] exprs)
| marked(BGFExpression expr)
| optional(BGFExpression expr)
| plus(BGFExpression expr)
| star(BGFExpression expr)
| starsepplus(BGFExpression expr, BGFExpression sep)
| starsepstar(BGFExpression expr, BGFExpression sep)
;

data BGFValue = string() | integer();
@@ -1,5 +1,7 @@
@contributor{Vadim Zaytsev - vadim@grammarware.net - CWI}
module XBGFSyntax
module syntax::XBGF

import syntax::BGF;

alias XBGFSequence = list[XBGFCommand];

Expand Down Expand Up @@ -68,27 +70,3 @@ data XBGFCommand =
data BGFContext =
globally()
;

data BGFProduction =
production (str label, str lhs, BGFExpression rhs)
;

data BGFExpression =
epsilon()
| empty()
| val(BGFValue v)
| anything()
| terminal(str t)
| nonterminal(str t)
| selectable(str selector, BGFExpression expr)
| sequence(list[BGFExpression] exprs)
| choice(list[BGFExpression] exprs)
| marked(BGFExpression expr)
| optional(BGFExpression expr)
| plus(BGFExpression expr)
| star(BGFExpression expr)
| starsepplus(BGFExpression expr, BGFExpression sep)
| starsepstar(BGFExpression expr, BGFExpression sep)
;

data BGFValue = string() | integer();

0 comments on commit 2ed2dbd

Please sign in to comment.