Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8892099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:54:33+00:00 2026-06-14T22:54:33+00:00

For a hobby project I am trying to write some poker application. Part of

  • 0

For a hobby project I am trying to write some poker application. Part of it’s functionality is the ability to parse messges from poker forums with games descriptions. Here are plain text version of message examples:

EXAMPLE 1

    $0.02/$0.05 No-Limit Hold'em (8 handed) 

Known players:
 BB: $1.70   UTG2: $13.05   MP1: $2.89   MP2: $2.64   MP3 (Hero): $5.28   CO
: $5.00   BU: $5.00   SB: $11.37  

Preflop: Hero is MP3 with 8 
[http://resources.pokerstrategy.com/smileys/heart.png], 8 
[http://resources.pokerstrategy.com/smileys/club.png].
UTG2 folds, MP1 raises to $0.15, MP2 calls $0.15, Hero calls $0.15, CO folds, 
BU calls $0.15,  2 folds, BB folds.

Flop: ($0.67) 8 [http://resources.pokerstrategy.com/smileys/diamond.png], K 
[http://resources.pokerstrategy.com/smileys/club.png], 6 
[http://resources.pokerstrategy.com/smileys/diamond.png] (4 players)
MP1 checks, MP2 checks, Hero bets $0.47, BU folds, MP1 folds, MP2 calls $0.47.

Turn: ($1.61) A [http://resources.pokerstrategy.com/smileys/club.png] (2 
players)
MP2 checks, Hero checks.

River: ($1.61) Q [http://resources.pokerstrategy.com/smileys/club.png] (2 
players)
MP2 bets $0.60, Hero raises to $2.10, MP2 calls $1.42.

Final Pot: $5.73.  

EXAMPLE 2

Grabbed by Holdem Manager <http://www.holdemmanager.net>
 NL Holdem $0.05(BB) Replayer 
 SB ($5.02)
 BB ($4.78)
 UTG ($2)
 UTG+1 ($2)
 UTG+2 ($1.88)
 MP1 ($5.32)
CO ($10.36) (21/18 на 109 рук, С-бет Ф=88%(11), С-бет Т=33%(3), АФ=2,6 
(4,5/3,0/0,5), WTSD=41%, W$SD=71%)
 Hero ($10.98)

Dealt to Hero 9 [http://resources.pokerstrategy.com/smileys/spade.png] T 
[http://resources.pokerstrategy.com/smileys/spade.png] 

 UTG calls $0.05, fold, fold, fold, CO raises to $0.20, Hero calls $0.20, 
fold, fold, fold

 FLOP ($0.52) J [http://resources.pokerstrategy.com/smileys/club.png] 8 
[http://resources.pokerstrategy.com/smileys/spade.png] 4 
[http://resources.pokerstrategy.com/smileys/diamond.png] 

CO bets $0.35, Hero calls $0.35

 TURN ($1.22) J [http://resources.pokerstrategy.com/smileys/club.png] 8 
[http://resources.pokerstrategy.com/smileys/spade.png] 4 
[http://resources.pokerstrategy.com/smileys/diamond.png] 9 
[http://resources.pokerstrategy.com/smileys/heart.png] 

CO checks, Hero checks

 RIVER ($1.22) J [http://resources.pokerstrategy.com/smileys/club.png] 8 
[http://resources.pokerstrategy.com/smileys/spade.png] 4 
[http://resources.pokerstrategy.com/smileys/diamond.png] 9 
[http://resources.pokerstrategy.com/smileys/heart.png] 4 
[http://resources.pokerstrategy.com/smileys/spade.png] 

CO bets $1, Hero ??? 

Basically these two examples were generated by two different converters. And there are currently about 20 different converters out there.

What I need to do is to be able to parse these game descriptions for different converters and “translate” text description of a game into java object Game. I’ve already written some code with a lot of regexp. This code can parse approximately 70% of my tests correctly, but:

  • it’s really hard to maintain
  • I want to teach myself something new and cool.

So, what are my other options besides regexp? I am currently looking into ANTLR, but I am not sure if it is a best choice for this task.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:54:34+00:00Added an answer on June 14, 2026 at 10:54 pm

    ANTLR would definitely be a good fit for your requirements. Using regular expression for language processing is very brittle and any changes from one version to another is significantly more likely to break your interpreter than if you use ANTLR or similar tools. What you may be able to do is write a single Lexer, and a base Parser, that can then be extended by more specific parsers for specific differences between the converters.

    Once you have made a Lexer and know what you’re doing with the parsers, it’s A LOT quicker to change things in ANTLR than in a roll-your-own solution! I do agree that ANTLR docs aren’t the best, but there are a ton of good tutorials out there for ANTLR 3 from third parties (and you’ll get good help here on SO for any specific problems).

    My personal preference is to make fairly simple Lexer/Parsers that output AST trees, then manually coding a tree-walker that walks the nodes as they’re provided by the Parser. Some will argue for making the tree-walker in ANTLR as well, but I found this more difficult and time consuming than it was worth (as it was largely not re-usable anyway).

    It may take a little while getting used to the mind-set of creating a good grammar file, but it’s very satisfying once you’ve done it and you see how much better it is the first time you need to modify or extend something. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a simple raytracer as a hobby project and it's all
I'm doing some prototyping with OpenCV for a hobby project involving processing of real
I'm in need of some inspiration. For a hobby project I am playing with
I have an idea for a hobby project which performs some code analysis and
I'm writing a 3D model viewer application as a hobby project, and also as
I recently diverged from business application programming to trying my hand (just as a
I'm writing a hobby project wherein I write to .wav files. I decided that
As part learning exercise, part hobby project, I am implementing my own interpretation of
I am working on a simple hobby project that checks when users connect/disconnect from
I working on an application as an hobby project. It is written in Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.