[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Grammatica-users] Grammar for expression...?
From: |
Yakov Keselman |
Subject: |
Re: [Grammatica-users] Grammar for expression...? |
Date: |
Tue, 19 Dec 2006 09:23:19 -0800 (PST) |
If I understand your difficulties correctly, you're unable to come up with a BNF grammar for your scripting language. My suggestion is to learn from "realistic" examples. For example, here is a link to a specificiation of the Java programming language in BNF:
http://www.csm.astate.edu/java-grammar.html
You can also try finding similar specs for other programming languages that you know.
I don't know of any general technique that would allow generating a BNF grammar out of an existing language.
= Yakov
Morten Aune Lyrstad <address@hidden> wrote:
I have downloaded Grammatica for use with my scripting language
Storyteller. I have serious problems understanding
the more advanced
grammar. I need to extend the _expression_ grammar you have given in your
example:
_expression_ = Term [ExpressionTail] ;
ExpressionTail = "+" _expression_
| "-" _expression_ ;
Term = Factor [TermTail] ;
TermTail = "*" Term
| "/" Term ;
Factor = Atom
| "(" _expression_ ")" ;
Atom = NUMBER
| IDENTIFIER ;
into one that is capable of handling all of a programming language's
common operators, like 'and', 'or', > etc. However, I don't really
understand what is going on here, and because of that I cannot extend
it. Why are the operators divided into two "tails"? And does this
support unary operators? Where should I add my other operators?
I was hoping you could give me a hand?
Thank you,
Morten
_______________________________________________
Grammatica-users mailing
list
address@hidden
http://lists.nongnu.org/mailman/listinfo/grammatica-users