Results 1 to 6 of 6

Thread: QLALR examples

  1. #1
    Join Date
    Jun 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default QLALR examples

    Hi everyone,

    Is there any good tutorials/online books I can read about QLALR? I think its quite odd that the only thing I can find is this one article called "QLALR Adventures" which didn't explain as much as I hoped.

    I want to set up some patterns and priorities to parse code like the one below and put it in a hierarchy QHash:
    Qt Code:
    1. foo
    2. {
    3. bar
    4. {
    5. ...
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

    I know this is possible with plain old regular expression but I heard LALR is better when it comes to more complex things.
    Last edited by dennis; 2nd October 2010 at 20:49.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QLALR examples

    There is no documentation and no tutorials on QLALR. If you want, I can try to help you with your task, I have a bit of experience with QLALR.

    What did you manage to do so far? Where are you stuck?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QLALR examples

    Actually I don't even know where to begin, I don't get the syntax used because I never used LALR before.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QLALR examples

    Don't worry about the syntax, you'll learn it along the way. First have a parser class ready. You can take the one (I think it is called QParser) from one of examples that accompany qlalr. You can test it (to accomodate it in your own project) with the provided scanner and grammar files. When that's done you should start by implementing a rudimentary scanner to return the basic tokens (aka terminal symbols -- symbols that can't be decoposed to simpler symbols) from your area of use. Then you can study a bit about BNF (Bachus-Naur Form) if you want. That should get you going with implementing the grammar. At this point don't worry about actions associated with the grammar - just make your input parse properly with the scanner/parser pair.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QLALR examples

    I finally got some time over to play around with qt so I checked out the QParser but I get this error message when I try to run it:

    :: error: No rule to make target `calc_grammar.cpp', needed by `debug/calc_grammar.o'. Stop.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QLALR examples

    Run qlalr on the provided .g file.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Configure Qt without examples?
    By Boron in forum Installation and Deployment
    Replies: 9
    Last Post: 8th September 2011, 18:24
  2. Qwt examples
    By nitriles in forum Qwt
    Replies: 7
    Last Post: 6th August 2011, 04:07
  3. examples and Ssl
    By szarek in forum Newbie
    Replies: 13
    Last Post: 21st July 2010, 22:33
  4. Qwt examples
    By 31512 in forum Qwt
    Replies: 11
    Last Post: 3rd July 2008, 05:00
  5. Qt 3.x Examples
    By ball in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 13:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.