BEX compiles LL(k) grammars to Java source code. The parser is designed to operate on "literal non-literal" or "literal white-space literal" grammars. That means grammars as for Java, C++ or other programming languages. Furthermore there are built in functions to detect strings, characters, numbers and comments.
BEX consists from two parts:
All software is published under our NON COMMERCIAL LICENSE. If you plan to use any of this software in a commercial product, contact the author for conditions and permissions.
Read, understand and accept the disclaimer before download db_bex.zip.
To get it work properly read the provided document and understand the examples.
Date | Description |
---|---|
2000-08-31 | version 1.7
|
2000-08-10 | version 1.6
since any alpha-literal is accepted and a new tokens are generated, there was a problem with keywords consisting from alpha and non-alpha characters. e.g. having 'div' and 'div=' as keywords: 'div=' was recognized as 'div' since the alpha-literal was used. now: 'div=' is recognized correctly |
2000-07-18 | version 1.5
|
2000-06-12 | version 1.4
|
2000-05-21 | version 1.3
|
2000-04-29 | version 1.2
|
2000-02-20 | version 1.1
|
/* * 1st example how to evaluate simple mathematic expressions */ Expression = Number // starts with a number ( ( '+' // accept operator +, -, *, / and ^ | '-' | '*' | '/' | '^' ) Expression // followed by an expression ) ? ;You will miss the definition for Number. There is none: Number is a function which accepts integer values in decimal, hexadecimal or octal format. We consider Number to be a terminal.
This example is provided as file Calc1.bnf. To get it compiled use
class Calc1 extends de.bb.bex.BnfLex { boolean isNumber() throws Exception { if (type != LX_INT) // is current token an integer value? return false; // no -> return false next(); // consume current token, setup next token! return true; // success! } }Now you are able to compile both classes and you get an program which verifies the content of files:
data.txt: 1+2 ^ 3*4-4 java -classpath %CLASSPATH%;bex.zip Calc1Lex data.txtAn invalid input is:
data.txt: 1+2 ^ 3%4-4 java -classpath %CLASSPATH%;bex.zip Calc1Lex data.txt error: java.io.IOException: unexpected '%' at line 1(8): 1+2 ^ 3%Note: Any white spaces are accepted!
You are ready to browse through the other examples.
Date | Grammars |
---|---|
2000-06-25 | Grammar for WmlScript is available here |
2000-04-29 | Grammar for JAVA is available here |
Disclaimer of Warranty
Software is provided "AS IS," without a warranty of any kind. You may use it on your own risk.
Limitation of Liability
I SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY YOU OR ANY THIRD PARTY AS A RESULT OF USING OR DISTRIBUTING SOFTWARE. IN NO EVENT WILL I BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF I HAVE ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Copyright
(c) 1999/2000 by BebboSoft, Stefan "Bebbo" Franke, all rights reserved