Any parser (like antlr) for Xojo?

Hi,

for some works I have to use a parser (I am using antlr4 at the moment) which prevents me to use Xojo. I was wondering if there are any parser for Xojo…
In case any of you had dealt with works which required to parse an input (not a trivial parsing), how did you handle them in Xojo?

Thanks.

Have you looked at the MBS plugin that allows you to work with java? https://www.monkeybreadsoftware.de/xojo/plugin-java.shtml

only know of these very simple ones :
http://www.charcoaldesign.co.uk/source/realbasic

http://www.charcoaldesign.co.uk/resources/parser.zip
http://www.charcoaldesign.co.uk/resources/tokenizer.zip

I wish
I could sure use one as I have an entire language that I’m parsing and being able to generate code from Antlr or Bison would be really handy

I see the appeal of “parser generators” like Antlr but honestly it often works out better to write your own. A decent recursive descent parser is not as challenging to write as you might think.

Check out Roo. It’s a scripting language I wrote in Xojo. It’s open source so feel free to inspect how it tokenises and parses the language.

I have a real love of language hacking so I’m happy to help out if I can. I’m currently writing a Markdown parser for an iOS project I’m working on so I’m literally surrounded by parsing code as we speak.

Thats what I’ve been resorting to
It’s just tedious to write, parse the code, return an AST so that the AST can be transformed from the original language into roughly equivalent Xojo code

What language are you trying to parse Norm? If you can say that is.

VB
A huge project in VB that needs to move to “something else”
Xojo is a natural fit because they are so close but there are some VBisms that simply have to be completely rewritten (open fie for input etc)
Since we’re trying to transform this code I really need an AST that I can apply various transforms to rather than just tokenize and emit byte code

Ah I see. If you crack it then I reckon they’d be a market to sell the transformer…

very much so
the form conversion at least preserves fidelity which the VBMA did not do at all (it made a real mess)
now code conversion - even if it gets 80 -90% and leaves some bits for review - would be a huge boost over where things are today

it still means that a VB -> Xojo project would have to be reviewed and very likely tweaked but the majority of the code should be usable as is

Sounds cool. I assume you’re targeting VB6 rather than .NET?

@Dave S has written a good MarkDown parser in Xojo (so I dont see why it cane be used on iOS). if you arent too far down the path, you might want to check his out. I use his in one of my apps for a client and they like it.

Thanks Scott. My parser has several advantages over Dave’s:

  1. Runs on iOS
  2. An order of magnitude faster
  3. Will be fully compliant with the common mark specs
  4. Provides the AST so you can implement a custom renderer (e.g: markdown -> Latex or Markdown -> PDF)

I’m hoping to sell it when it’s finished.

Yeah this is moving a huge VB6 app to “something else” which at this point looks like Xojo
It could end up being “something else” - well see