Skip to content

Commit

Permalink
Switch to an infix functor for sequential composition
Browse files Browse the repository at this point in the history
  • Loading branch information
grammarware committed Jan 25, 2013
1 parent d35cc96 commit 07713ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions shared/rascal/src/demo/SkeletonCS.rsc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@contributor{BGF2Rascal automated exporter - SLPS - http://github.com/grammarware/slps/wiki/BGF2Rascal}
@contributor{Vadim Zaytsev - vadim@grammarware.net - SWAT, CWI}
module demo::SkeletonCS

import ParseTree;
Expand Down
17 changes: 7 additions & 10 deletions shared/rascal/src/export/PNF.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ public str ppnf(BGFProdList ps) = mapjoin(ppnf,ps,"\n");

public str ppnf(set[BGFProduction] ps) = mapjoin(ppnf,ps,"\n");

public str ppnf(BGFProduction p) = "\\textit{<p.lhs>} ::= <ppnftop(p.rhs)> ;";
public str ppnf(BGFProduction p) = "\\p(\\textit{<p.lhs>}, <ppnf(p.rhs)> ) ;";

str ppnftop(sequence(BGFExprList es)) = "(<ppnf(es)>)";
default str ppnftop(BGFExpression e) = ppnf(e);
// public str ppnf(BGFExprList es) = mapjoin(ppnf,es,", ");

public str ppnf(BGFExprList es) = mapjoin(ppnf,es,", ");

public str ppnf(epsilon()) = "\\true";
public str ppnf(empty()) = "\\false";
public str ppnf(epsilon()) = "\\varepsilon";
public str ppnf(empty()) = "\\varphi";
public str ppnf(val(string())) = "\\mathit{str}";
public str ppnf(val(integer())) = "\\mathit{int}";
public str ppnf(anything()) = "ANYTHING";
public str ppnf(anything()) = "\\alpha";
public str ppnf(terminal(str s)) = "\\te(\\textit{<s>})";
public str ppnf(nonterminal(str s)) = "\\n(\\textit{<s>})";
public str ppnf(selectable(s,e)) = "\\s(<s>,<ppnfost(e)>)";
public str ppnf(sequence(L)) = "(<mapjoin(ppnf,L,", ")>)";
public str ppnf(selectable(s,e)) = "\\s(<s>, <ppnfost(e)>)";
public str ppnf(sequence(L)) = "<mapjoin(ppnf,L," \\cdot ")>";
public str ppnf(choice(L)) = "\\dis([<mapjoin(ppnf,L,"; ")>])";
public str ppnf(allof(L)) = "\\con([<mapjoin(ppnf,L,"; ")>])";
public str ppnf(marked(e)) = "\\langle<ppnf(e)>\\rangle";
Expand Down

0 comments on commit 07713ba

Please sign in to comment.