File: syntax.bnf

package info (click to toggle)
storm-lang 0.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 52,004 kB
  • sloc: ansic: 261,462; cpp: 140,405; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (47 lines) | stat: -rw-r--r-- 2,051 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use core.lang;
use lang.bs;
use layout;

// Borrow the low-level syntax from Basic Storm.
optional delimiter = SDelimiter;
required delimiter = SRequiredDelimiter;

// Entry point to the grammar: declare a presentation.
SPlainFileItem => PresDecl(name, title, env, cont) : "presentation" #keyword ~ SName name #typeName, SDumbString title, "{" [, SPresCont @cont,]+ "}";

// Contents of a presentation block...
void SPresCont(ExprBlock me);
SPresCont : (SPresStmt(me) -> add,)*;

// either regular Basic Storm statements, or our special ones.
Expr SPresStmt(Block block);
SPresStmt => e : SStmt(block) e;
SPresStmt => slideLayout(block, layout, name, intro)
	: (SName name, "=", )? "slide" #keyword ~ SIntro(block) intro, SLayoutRoot(block) layout;
SPresStmt => slidePlainLayout(block, layout, name, intro)
        : (SName name, "=", )? "borderless" #keyword ~ "slide" #keyword ~ SIntro(block) intro, SLayoutRoot(block) layout;
SPresStmt => slideBackground(block, layout)
	: "background" #keyword ~ SLayoutRoot(block) layout;

// Slide intro animation.
Maybe<Expr> SIntro(Block block);
SIntro => Maybe<Expr>() : ;
SIntro => slideIntro(block, name, params) : SType name, SParamList(block) params, "=>";
SIntro => slideIntro(block, name, params) : SType name, "(", SParamList(block) params, ")", "=>";

// Extend the syntax to allow skipping parens around parameter lists inside presentation blocks.
SPresStmt..SLayout => LayoutBlock(block, name, params) : SType name, SParamList(block.block) params, "{" [, SLayoutContent(me), ]+ "}";

// Specify animations for elements.
SLayoutItem => add(block, ani) : SElemAni(block.block) ani, ";";


// Create animations for elements.
AniDecl SElemAni(Block block);
SElemAni => AniDecl(block, step, name, params)
	: "@" #keyword, "[0-9]+" step #constant, (SAniOpts(me, block),)* ":", SType name, SParamList(block) params;

// Animation options.
void SAniOpts(AniDecl to, Block block);
SAniOpts => setOffset(to, time) : "+" #keyword, SExpr(block) time;
SAniOpts => setDuration(to, time) : ",", SExpr(block) time;