Lola-2 Lexer Grammar Rules Help

All questions regarding lexer highlighting schemes are discussed here...
Locked
captbill
Posts: 8
Joined: 04.12.2015 16:17

Lola-2 Lexer Grammar Rules Help

Post by captbill »

Hi Alexey,
I am trying learn how to use the 'grammar rules' for a lexer for Lola-2. Lola-2 is an Oberon based Verilog code generator.

Here is the lexer file:
https://github.com/billbuzzell/PRJ_Ober ... a-2exp.zip

Can you take a look? I can't seem to locate where my problem is here:

Code: Select all

InputType = (IN|OUT|INOUT)
DataType = (BIT|BYTE|WORD)

InheritedList = '(' IdentList ')';
IdentList = InputType <Identifier> ':' DataType? ';';

TOPModuleDecl = 'MODULE' <Identifier> InheritedList ';';  
TMODULE = <Identifier> ':=' 'MODULE' InheritedList '^;' ;
Last edited by captbill on 29.01.2016 17:27, edited 1 time in total.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

first, replace IN|OUT to 'IN'|'OUT'. 2nd, missed ; at lineends. 3rd, missed end-rule for begin-rule.
captbill
Posts: 8
Joined: 04.12.2015 16:17

Post by captbill »

I like the idea of having everything in one place with the 'grammar rules', unfortunately it uses some non-standard regex notations. What I have decided is to use it just for notes, for now, and build it up, piece by piece in the typical fashion of the SynWrite 'customize lexer' dialogs. Seems to work well.

Here is my current work with Lola-2:
https://github.com/billbuzzell/PRJ_Ober ... Lola-2.zip

I am learning slowly but surely. It is a very tricky skill, it seems. You have done a fine job with the lexer builder of SynWrite. Much better than trying to code from scratch a lexer for SynEdit by hand.

Regards,
Bill
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Hey Bill
What is the state of Lola-2 work? how is it finished, or not.

UPD:
now I took your 2 lexers. PICL and Lola. and finished em. I think so at last. Folding is ok, even from "module NN" to "end NN". deleted 2-3 styles, 2-3 rules. added style "types" for types of langs (bool-int-...). deleted crap "proc[]" and "proc()" rules.
Take all in AddonManager
captbill
Posts: 8
Joined: 04.12.2015 16:17

Post by captbill »

Excellent. Thanks, Alexey. I will now try them out. Sorry for delay. I missed the e-mail notification.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

I welcome suggestions for them
captbill
Posts: 8
Joined: 04.12.2015 16:17

Post by captbill »

Alexey wrote:I welcome suggestions for them
Had a quick look at them and they seem good. I did notice a few issues with the color highlighting. Perhaps it's best to have no color highlighting and let that be user's choice to add, you think? Would also like to see the Oberon lexer with a nice tree view like the Lola-2 lexer.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

>no color highlighting
Default must be like eg C++/Go, and u can change colors in Lexer Prop dlg

Oberon: pls make topic at github. post some examples for tree. https://github.com/Alexey-T/SynWrite
captbill
Posts: 8
Joined: 04.12.2015 16:17

Post by captbill »

Oh thanks, but I mean I would fix the Oberon treeview. It should not be hard. I will work on it shortly.

What I may need some help with is a "save file to Oberon" plugin/dialog for the Oberon emulator that I may make a topic on.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Plugin can make Open or Save dlg. it is function dlg_file in Cudatext+Synwrite https://sourceforge.net/p/synwrite/wiki ... %20dialog/
Locked