Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98cdd59
commit 2ed2dbd
Showing
7 changed files
with
61 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this directory contains a Rascal Project called "slps" |
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 @@ | ||
@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
23
shared/rascal/src/XBGF.rsc → shared/rascal/src/io/ReadXBGF.rsc
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,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(); |
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