[antlr-interest] One weird, one (hopefully) simple problem
.. . from a newbie
Robert Colquhoun
rjc at trump.net.au
Mon Jan 27 04:11:04 PST 2003
At 08:16 AM 27/01/2003 +0000, Anthony W. Youngman wrote:
>Hi Rob,
>
>I thought I'd meet you here.
>
>Yes it is based very heavily on your grammar. I thought the best way to
>get to grips with both the grammar and Antlr was to tackle something where
>I knew what it was supposed to be doing. And as a learning exercise,
>redoing a worked example is always a good idea :-)
This BASIC version mightn't be the best one to learn stuff on, it has lots
of bad stuff in it:
- Predefined language identifiers may also be used for variable names
- EOL is sometimes whitespace and sometimes significant to the parser
- ';' can also be used to terminate statements as well as used as a
separator within statements
- Somebody defined a ' ' operator(a single space character) which does
formatting.
- Both arrays and functions use '(...)' for arguments ie A(B) could be
call function or dereference A at index B.
- * is sometimes multiply, sometimes start comment
- ! is sometimes OR operator, sometimes start comment
- REM is sometimes a variable, sometimes REMainder function, sometimes
start comment
- Has a second kind of array which uses < > for indexes, < > are also
conditional operators freely mixed together in expressions.
- ':' has been used for labels(goto targets), as a concatenation operator
as well as adding special meaning to certain other statements
- .....plus lots other things that caused late nights which i cant
remember offhand!
It might be better to start with something like tinybasic(by Sinan i think)
in the examples directory and try to build that up, especially if you are
used to C and not particularly comfortable with java/C++ or parser
generators in general.
>Plus I'm going to have another stab at my C code. See if I get any further
>this time...
Rewrite the compiler/runtime to use C instead of java?
- Robert
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list