Patterns for complex parsers, scanner, compilers

Can anyone suggest some good pattern sequence or some resurces on the net that can help in designing complex language parsers, scanners and things like that?
I developed a simple sql parser in java that starting from a query string extract a kind of query object model of the query, with param objects, clauses, etc., it works actually but i ended up with few complex methods that have a really high cyclomatic complexity, , very bad :)), so it shurely could be improved using the right patterns i guess.
Bye, thx
Benny

Look at JavaCC:
https://javacc.dev.java.net/
It's a great Java lex/yacc tool that's been around for a very long time. (I first used it in 1999). It's based on the GOF Interpreter. If you can express your problem in a grammar, it might be a good solution. - MOD

Similar Messages

  • J2EE pattern for complex database searches

    I am havin trouble finding a method for doing complex searches that I am happy with.
    I have a table of "log entrys" - each "log entry" is composed of an "admin user", "action" and one or two "target" value objects, as well as a Timestamp.
    The problem here is a user, through a JSP form, will want to run searches such as "Get me all logs for user X between time Y and time Z involoing action A".
    What is the best way of encapsulating this between the Web Tier and the EJB tier (obviously, once it's in the EJB Tier, it's time to translate it into SQL in the DAO and send the query off to the database).
    Is it as simple as having a "Search Criteria" class containing many constants (e.g. SEARCH_BY_USER_ID, SEARCH_BY_MIN_TIME) and each instance of search criteria holding a map (e.g. "SEARCH_BY_USER_ID" => "BDTURNE", "SEARCH_BY_MIN_TIME" => "21st August") - or is there a better / neater way of encapsulating this call ?
    All ideas / suggesitons welcomed !
    Cheers,
    Ben Turner

    I think it is good Idea to have some constants like USERID, MINTIME, etc and can dynamically formulate the Query depending on the Data you are getting.

  • I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide? can this be automated?

    I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide?
    can this be automated?

    Not in Illustrator. You will need a CAD program or similar where you can dial in such manufacturing criteria.
    Mylenium

  • I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide?

    I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide?
    can this be automated?

    do you mean Anchor Point to Anchor Point should be less than 7mm? A Script could check segment lengths, on demand, not automatically as you draw.

  • Re: pattern for persistance management: the solution?

    Thanks to Forte France consulting group and Marc Sonnet (Forte
    France), here is one solution for our problem.
    We don't have test it yet but this seems pretty good.
    thanks for all your replies,
    Corinne Barbat
    ____________________________ Séparateur Réponse ________________________________
    Objet : Re: Bloated clients (was: pattern for persistance management
    Auteur : [email protected] à _INTERNET
    Date : 23/10/98 00:41
    Geoff,
    Fromhat I've understood of Forte's partitioning behaviour, the only
    way to get rid of b, c, d and e Projects from the client partition is by
    deploying them as a shared library and having the Client dynamically
    load them at run-time. Any other way, including creating a complex
    structure of interfaces to avoid the client referencing the other
    projects directly, or even deploying the Server projects as another
    Application, will not prevent these projects from being included in the
    Client Partition.
    The problem I guess is that when we think along the lines of components
    we immediately associate them with Service Objects. Clearly, it's the
    Project and not the SO which can be classified as a component in Forte.
    The questions I have is : Now that we know how Forte's Partioning
    mechanism works, would it significantly impact the way we partition our
    Apps ? I'm not so sure.
    Eric
    ----Original Message Follows----
    Date: Thu, 22 Oct 1998 14:52:29 -0400
    From: Geoff Puterbaugh <[email protected]>
    To: [email protected]
    Subject: Bloated clients (was: pattern for persistance management)
    Reply-To: Geoff Puterbaugh <[email protected]>
    This topic is of keen interest to me as well. At my customer's
    urging, I wrote a little test application spread across
    four or five projects, each supplying the next..
    a << b << c << d << e
    The projects b,c,d, and e each contain a class and a service
    object based on that class. I partitioned it (a client
    partition and four server partitions for b c d e) and made
    a distribution. Then I looked at the client partition
    and discovered b c d e were projects for it!
    If you code-generate this and run fcompile, you will see
    that all the code for all the projects in the entire chain
    of supplier projects winds up in the client partition.
    To be clear about this, if project e contains a class X,
    you will see the source code for X.init and all other
    X methods in the client partition.
    This appears to be the default behavior, and the open
    question is how to change the default behavior, if that
    can be done.
    All my best,
    Geoff
    P.S. If e uses GenericDBMS as a supplier, it will show up
    in the client too. Of course!
    This is at least my understanding as of today.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Thanks to Forte France consulting group and Marc Sonnet (Forte
    France), here is one solution for our problem.
    We don't have test it yet but this seems pretty good.
    thanks for all your replies,
    Corinne Barbat
    ____________________________ S&eacute;parateur R&eacute;ponse ________________________________
    Objet : Re: Bloated clients (was: pattern for persistance management
    Auteur : [email protected] &agrave; _INTERNET
    Date : 23/10/98 00:41
    Geoff,
    Fromhat I've understood of Forte's partitioning behaviour, the only
    way to get rid of b, c, d and e Projects from the client partition is by
    deploying them as a shared library and having the Client dynamically
    load them at run-time. Any other way, including creating a complex
    structure of interfaces to avoid the client referencing the other
    projects directly, or even deploying the Server projects as another
    Application, will not prevent these projects from being included in the
    Client Partition.
    The problem I guess is that when we think along the lines of components
    we immediately associate them with Service Objects. Clearly, it's the
    Project and not the SO which can be classified as a component in Forte.
    The questions I have is : Now that we know how Forte's Partioning
    mechanism works, would it significantly impact the way we partition our
    Apps ? I'm not so sure.
    Eric
    ----Original Message Follows----
    Date: Thu, 22 Oct 1998 14:52:29 -0400
    From: Geoff Puterbaugh <[email protected]>
    To: [email protected]
    Subject: Bloated clients (was: pattern for persistance management)
    Reply-To: Geoff Puterbaugh <[email protected]>
    This topic is of keen interest to me as well. At my customer's
    urging, I wrote a little test application spread across
    four or five projects, each supplying the next..
    a << b << c << d << e
    The projects b,c,d, and e each contain a class and a service
    object based on that class. I partitioned it (a client
    partition and four server partitions for b c d e) and made
    a distribution. Then I looked at the client partition
    and discovered b c d e were projects for it!
    If you code-generate this and run fcompile, you will see
    that all the code for all the projects in the entire chain
    of supplier projects winds up in the client partition.
    To be clear about this, if project e contains a class X,
    you will see the source code for X.init and all other
    X methods in the client partition.
    This appears to be the default behavior, and the open
    question is how to change the default behavior, if that
    can be done.
    All my best,
    Geoff
    P.S. If e uses GenericDBMS as a supplier, it will show up
    in the client too. Of course!
    This is at least my understanding as of today.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Re: Bloated clients (was: pattern for persistancemanagement)

    Geoff,
    From what I've understood of Forte's partitioning behaviour, the only way to get rid of b, c, d and e Projects from the client partition is by
    deploying them as a shared library and having the Client dynamically
    load them at run-time. Any other way, including creating a complex
    structure of interfaces to avoid the client referencing the other
    projects directly, or even deploying the Server projects as another
    Application, will not prevent these projects from being included in the
    Client Partition.
    The problem I guess is that when we think along the lines of components
    we immediately associate them with Service Objects. Clearly, it's the
    Project and not the SO which can be classified as a component in Forte.
    The questions I have is : Now that we know how Forte's Partioning
    mechanism works, would it significantly impact the way we partition our
    Apps ? I'm not so sure.
    Eric
    ----Original Message Follows----
    Date: Thu, 22 Oct 1998 14:52:29 -0400
    From: Geoff Puterbaugh <[email protected]>
    To: [email protected]
    Subject: Bloated clients (was: pattern for persistance management)
    Reply-To: Geoff Puterbaugh <[email protected]>
    This topic is of keen interest to me as well. At my customer's
    urging, I wrote a little test application spread across
    four or five projects, each supplying the next..
    a << b << c << d << e
    The projects b,c,d, and e each contain a class and a service
    object based on that class. I partitioned it (a client
    partition and four server partitions for b c d e) and made
    a distribution. Then I looked at the client partition
    and discovered b c d e were projects for it!
    If you code-generate this and run fcompile, you will see
    that all the code for all the projects in the entire chain
    of supplier projects winds up in the client partition.
    To be clear about this, if project e contains a class X,
    you will see the source code for X.init and all other
    X methods in the client partition.
    This appears to be the default behavior, and the open
    question is how to change the default behavior, if that
    can be done.
    All my best,
    Geoff
    P.S. If e uses GenericDBMS as a supplier, it will show up
    in the client too. Of course!
    This is at least my understanding as of today.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Geoff,
    From what I've understood of Forte's partitioning behaviour, the only way to get rid of b, c, d and e Projects from the client partition is by
    deploying them as a shared library and having the Client dynamically
    load them at run-time. Any other way, including creating a complex
    structure of interfaces to avoid the client referencing the other
    projects directly, or even deploying the Server projects as another
    Application, will not prevent these projects from being included in the
    Client Partition.
    The problem I guess is that when we think along the lines of components
    we immediately associate them with Service Objects. Clearly, it's the
    Project and not the SO which can be classified as a component in Forte.
    The questions I have is : Now that we know how Forte's Partioning
    mechanism works, would it significantly impact the way we partition our
    Apps ? I'm not so sure.
    Eric
    ----Original Message Follows----
    Date: Thu, 22 Oct 1998 14:52:29 -0400
    From: Geoff Puterbaugh <[email protected]>
    To: [email protected]
    Subject: Bloated clients (was: pattern for persistance management)
    Reply-To: Geoff Puterbaugh <[email protected]>
    This topic is of keen interest to me as well. At my customer's
    urging, I wrote a little test application spread across
    four or five projects, each supplying the next..
    a << b << c << d << e
    The projects b,c,d, and e each contain a class and a service
    object based on that class. I partitioned it (a client
    partition and four server partitions for b c d e) and made
    a distribution. Then I looked at the client partition
    and discovered b c d e were projects for it!
    If you code-generate this and run fcompile, you will see
    that all the code for all the projects in the entire chain
    of supplier projects winds up in the client partition.
    To be clear about this, if project e contains a class X,
    you will see the source code for X.init and all other
    X methods in the client partition.
    This appears to be the default behavior, and the open
    question is how to change the default behavior, if that
    can be done.
    All my best,
    Geoff
    P.S. If e uses GenericDBMS as a supplier, it will show up
    in the client too. Of course!
    This is at least my understanding as of today.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Books about MVVM, architecture, design patterns for Windows Phone 8.1

    Hi,
    I'm looking for a book or books (or other resources) that explain how to develop an app with a proper architecture. I mean what each layer (bussines layer, data layer, network access) should do and how should it look like. I'm also looking for a book about
    MVVM.
    Right now I'm struggling with how to create a layer for network communication - how to separate classes for requests and responses, how to manage requests and create some queue of requests and also to provide some way to cancel them when they are no longer
    needed, how to work with servers that use some level of security (cookies, certificates etc.).
    Another thing is caching - how to design a short-term cache or a persistant cache (database), what technologies I can use etc.
    Last thing that I'm struggling with is also naming. How to name classes in those layers, e.g. to distinguish between classes mapping data from some ORM database, for mapping on JSON in network communication. etc.
    I hope you got the idea :)
    Thanks.

    Currently, I don't find a book about MVVM pattern for Windows Phone 8.1, but I think MSDN and some blogs have some useful samples and conceptions: http://msdn.microsoft.com/en-us/library/windows/apps/jj883732.aspx
    http://channel9.msdn.com/Series/Windows-Phone-8-1-Development-for-Absolute-Beginners
    And I think your question includes too much scopes, maybe you need to split it into some blocks and get help in the related forum
    Best Regards,
    Please remember to mark the replies as answers if they help

  • CVP Opsconsole: Patterns for RNA timeout on outbound SIP calls - Dialed Number (DN) text box does not take any input

    Hi there,
    I'm having problems modifying the 'Dialed Number (DN)' text box under 'Advanced Configuration->Patterns for RNA timeout on outbound SIP calls' of the SIP tab in the Cisco Unified Customer Voice Portal 8.5(1) opsconsole. In a nut shell, I need to change the RNA timeout but some reason when typing into the Dialed Number text box, the input is not taken. The reason I want to change this settings is because my ICM Rona is not working with CVP:
    https://supportforums.cisco.com/thread/2031366
    Thanks in advance for any help.
    Carlos A Trivino
    [email protected]

    Hello Dale,
    CVP doesn't allow you to exceed the RNA more than 60  Seconds. If you want to configure the timer for DN Patterns you should  do it via OPS console, It would update the sip.properties files in  correct way, the above way is incorrect.
    Regards,
    Senthil

  • How to enter a valid Edit Pattern for Time?

    I'm tring to enter a pattern for the Edit Pattern and it kept giving me the invalid pattern error.
    Here is what I have for the Display Pattern: h:MM A
    And for Edit Pattern: h|hh|h:MM|h A|hh A|h:MM A|hh:MM A
    The textbox is set to Type: Date/Time Field.
    Help is appreciated.

    [email protected] wrote:
    > I'm tring to enter a pattern for the Edit Pattern and it kept giving me the invalid pattern error.
    >
    > Here is what I have for the Display Pattern: h:MM A
    > And for Edit Pattern: h|hh|h:MM|h A|hh A|h:MM A|hh:MM A
    >
    > The textbox is set to Type: Date/Time Field.
    >
    > Help is appreciated.
    The last two are the only valid edit patterns. All of the others are invalid. Here are the reasons:
    - You have to specify the minutes
    - If not using military hours (H, HH) you have to specify AM or PM
    The only way to support the other patterns you are trying to use is to make it a text field and put
    custom javascript validation on it.
    Justin Klei
    Cardinal Solutions Group
    www.cardinalsolutions.com

  • What is the best design pattern for this problem?

    No code to go with the question. I am trying to settle on the best design pattern for the problem before I code. I want to use an Object Oriented approach.
    I have included a basic UML diagram of what I was thinking so far. 
    Stated simply, I have three devices; Module, Wired Modem, and Wireless Modem.
    In the Device Under Test parent class, I have put the attributes that are variable from device to device, but common to all of them.
    In the child classes, I have put the attributes that are not variable to each copy of that device. The attributes are common across device types. I was planning to use controls in the class definition that have the data set to a default value, since it doesn't change for each serial number of that device. For example, a Module will always have a Device Type ID of 1. These values are used to query the database.
    An example query would be [DHR].[GetDeviceActiveVersions] '39288', 1, '4/26/2012 12:18:52 PM'
    The '1' is the device type ID, the 39288 is the serial number, and the return would be "A000" or "S002", for example.
    So, I would be pulling the Serial Number and Device Type ID from the Device Under Test parent and child, and passing them to the Database using a SQL string stored in the control of the Active Versions child class of Database.
    The overall idea is that the same data is used to send multiple queries to the database and receiving back various data that I then evaluate for pass of fail, and for date order.
    What I can't settle on is the approach. Should it be a Strategy pattern, A Chain of Command pattern, a Decorator pattern or something else. 
    Ideas?

    elrathia wrote:
    Hi Ben,
    I haven't much idea of how override works and when you would use it and why. I'm the newest of the new here. 
    Good. At least you will not be smaking with a OPPer dOOPer hammer if I make some gramatical mistake.
    You may want to look at this thread in the BreakPoint where i trie to help Cory get a handle on Dynamic Dispatching with an example of two classes that inherit from a common parent and invoke Over-ride VIs to do the same thing but with wildly varying results.
    The example uses a Class of "Numeric"  and a sibling class "Text" and the both implement an Add method.
    It is dirt simple and Cory did a decent job of explaining it.
    It just be the motivation you are looking for.
    have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Alternative to Photoshop for Importing from Scanner (Mustek A3)

    Since Ps CS3 or CS4 it is not possible anymore to import directly from the Scanner. I bought a Mustek A3 Scan Express that works under VMWare Fusion/Windows XP and also came with drivers for Mac OS X. Unfortunately no scan software. It says "Use your Image Editing Software to scan".
    Having two versions of Ps can cause complications. What other (cheap) applications can I use just to scan?
    Thanks!

    This software package may support your needs.
    http://www.hamrick.com/
    As a point of information: CS3 supports for my Canon scanner but no longer provided with CS 4.
    I use the CS3 version to import than save and open CS4 to do any needed work. Also the above link is a software package, last time I checked, did independent scans as well. Perhaps a new version is available that offers interface with Photoshop?

  • Trying to download the latest update for Epson printer/scanner but although it starts (up to about 5KB) it stops without completing. The download list shows it is installed ( 8 times!) but there is nothing in Finder downloads

    Trying to download the latest update for Epson printer/scanner but although it starts (up to about 5KB of 26.8MB) it stops without completing. The download list shows it is installed ( 8 times!) but there is nothing in Finder downloads. What can I do to download this update

    Try re-indexing Spotlight.
    Spotlight – Re-index
    If you haven't done so already, try resetting the printing system.
    OS X Mavericks: Reset the printing system  also Yosemite
    Applications/Image Capture or VueScan work?
    VueScan
    VueScan FAQ

  • Nested SQL statements for complex, detailed queries.

    Is it  possible to write nested SQL statements for complex, detailed queries. A nested query
    has a WHERE clause that includes a SELECT statement ? Is it true or false ?

    Hi wahid,
    Here are pretty good examples: 
    http://www.databasejournal.com/features/mssql/article.php/3464481/Using-a-Subquery-in-a-T-SQL-Statement.htm
    http://technet.microsoft.com/en-us/library/aa213252(v=sql.80).aspx
    Regards Harsh

  • E-mail pattern for self registration screen

    Hello,
    We are using WAS version 7.01 SP3 .
    We configured the UME to enable self registration.
    The generated password sent via Email and everything working correct.
    The only problem is that the user can use wrong E-mail pattern and the creation process will continue
    (User will create in the system with wrong E-mail pattern for example -  XYZ).
    When we tried to create user with wrong E-mail pattern in the standard user creation program it raised error message.
    We are using the default E-mail pattern on the Configtool.
    Is there any way to stop the self registration process if the user enter wrong E-mail pattern?
    Thanks for the help
    Nir

    Hi,
    You can try forcing the application to quit as described here:
    +To force an application to close, follow these steps:+
    +iPhone or iPod touch running iPhone OS 3.0 or later+
    +Press and hold the Sleep/Wake button until the red slider appears. When the red slider appears, release the Sleep/Wake button.+
    +Instead of dragging the red slider, press and hold the Home button for six seconds.+
    +If the device does not return to the Home screen, see the steps below to restart.+
    from: http://support.apple.com/kb/TS1445
    If the issue persists, you should try restarting before trying to reset.
    You can restart the iPhone by holding the Sleep/Wake button until the red slider appears> then slide to turn off> and turn the iPhone back on by pressing the Sleep/Wake again, as described on page 46 of the iPhone User Guide.
    http://manuals.info.apple.com/en/iPhoneUserGuide.pdf
    -Jason

  • How to change the Display Pattern for Decimal Fields dynamically

    hi all,
    Can any one help me how to change the display pattern for decimal fields dynamically???
    Currently I am using z,zzz,zzz,zz9.999 Display pattern for Quantity Field. If the value is blank it is displaying as 0.000 on the Screen. But I don't want this to be printed.
    Please help me how to solve this ASAP.
    Thanks,
    Prabhu

    Hi,
    Alternatively you can handle it in the context.
    In the context area, click on the quantity. In the bottom, click on the conditions tab, and put a condition
    <quan field> NE initial.
    So the field will not be printed if there is no value.
    Regards,
    Vidya Chowdhary A.

Maybe you are looking for

  • Xorg 7.0 upgraders read this

    http://wiki.archlinux.org/index.php/Xorg7

  • Selecting all columns makes oracle use more indexes than only selectng one?

    I have 3 queries here that differ only slightly, conceptually, but the plans are massively different. What I cant work out is that the difference is only in the select list.. The fields referenced in the where clause are properly indexed for this pur

  • Please explain 21CN

    Looking on www.samknows.com, my exchange EAWDF says it is 21CN "enabled". What does this mean ? my IP profile is around 6500 and download speed about 5500. Does 21CN enabled mean I could get these increased if a talk to BT ? If yes who is best to cal

  • N80 V4 software updater fails

    After all of my bluetooth and memory issues my firmware update just failed for no reason when it was updating, now my phone is completly dead, YAY!...... Anyway.... I live about 5 miles from Huntingdon where from what i have heard is a Nokia service

  • Why is my blackberry sending out duplicate emails?

     My blackberry is sending out duplicate emails - one for each of my email addresses, regardless of the originating email address. How can I stop this?