[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Writing a @Bnf enviroment
From: |
Benedikt Grundmann |
Subject: |
Writing a @Bnf enviroment |
Date: |
Thu, 24 Jul 2003 09:47:42 +0200 |
User-agent: |
KMail/1.5.2 |
Hello Folks,
I want to write a simple bnf syntax diagram layouting command. I thought of
something like this:
@Bnf
@Begin
expression := {
kw if expression kw then
expression
kw else
expression
kw end
}
@End @Bnf
Which I wanted to expand into:
@Tbl
aformat { @Cell A | @Cell B | @Cell C }
@Begin
@Rowa A { expression } B { := } C { lines @Break {
@B if expression @B then
expression
@B else
expression
@B end
}
}
@End @Tbl
In order to achieve that I wrote this definition:
import @Tbl @BasicSetup
export kw ":=" "||"
def @Bnf
body x
{
def kw
right k
{ @B k }
def ":="
left name
body b
{ @Rowa A { name } B { ":=" } C { lines @Break b } }
def "||"
body b
{ @Rowa A {} B { "|" } C { lines @Break b } }
@Tbl
aformat { @Cell A | @Cell B | @Cell C }
@Begin
x
@End @Tbl
}
But unfortunately it does not work :-( It displays nothing at all.
What did I do wrong?
Cheers and thanks for any help,
Benedikt Grundmann
PS: Yes I know about @SyntaxDiag it's just not what I need.
- Writing a @Bnf enviroment,
Benedikt Grundmann <=