Questions tagged [parsing]

Parsing is the process of analysing a string of symbols, either in natural language or in computer languages, conforming to the rules of a formal grammar.

Filter by
Sorted by
Tagged with
8
votes
4answers
223 views

Parse a simple key=value config file in C

Write a program that should read a file formatted strictly like this below: $ cat sample bingo=2 bingo2=939 bingo3=text The left and right side of ...
6
votes
1answer
181 views

CIS 194 Homework 2: Parsing an error log

Here is another reference solution, that I discovered after writing my own: https://insight.io/github.com/beloglazov/haskell-course/blob/HEAD/hw2.hs I am following this lecture course as a ...
5
votes
1answer
165 views

Program to process fastq files

My program evaluates fastq files. The fastq file is just a huge text file (about 1,5gb in my case), which looks like this: ...
2
votes
1answer
195 views

Simple state machine based command-line argument parser

I'm in the process of learning to write idiomatic JavaScript code so naturally I'm parsing command line arguments. My approach to this is to have a simple state machine. The parser should work as ...
3
votes
1answer
771 views

Multi-query PHP Parser for SQL files

I have an external project, which needs to run an SQL file containing multiple SQL queries (a bit like mysqldump, if you like, but is user-created, with any kind of SQL statement/definition). PHP ...
2
votes
0answers
24 views

Command String Parser

I'm working on a library that, in essence, splits a string at whitespace, with extra rules: Consecutive whitespace is collapsed, and trimmed at the start and end. Whitespace wrapped in quotes is not ...
5
votes
1answer
90 views

Python API for TreeStructInfo - new simple config format

I've created a simple (300 SLOC) API for a new configuration format (I'm not the author of it). Unfortunately, the specification is only in Polish at the moment, but you can see how it looks here. ...
3
votes
0answers
57 views

Footwear scraper

I've done this parser to scrape all footwear data, but I don't know if it is good to use OOP in this case. Can you please check this out and give me the strongest feedback? I'm working on improving my ...
10
votes
1answer
120 views

Visual Studio exception visualizer for lengthy exception messages

I use Autofac a lot and for everything and when you make a mistake and forget to register a dependency etc. it'll tell you exaclty what's wrong. Although its ...
1
vote
0answers
26 views

git status parser using regular expressions in javascript

I'm looking for improvements of a code that filter the output of git status --ignored and git status --ignored -bs commands. I ...
4
votes
1answer
47 views

Wavefront 3D Obj parser/viewer

For learning Rust I decided to make a 3D .obj viewer. I wrote a simplified OBJ parser without materials that only supports triangles. Considering I'm completely new to Rust and don't really know ...
4
votes
2answers
181 views

Parser for STL stereolithography data files [closed]

I'm parsing STL files to load the coordinates. My code is: ...
6
votes
4answers
1k views

Parse source code of the RAPID robot-automation language

I am new to C, and I have very little formal education on programming (Although I am currently in college). I work as a Robot Automation technician, and me and my team are required to document a lot ...
2
votes
1answer
59 views

JSON Parser, pulls data from a JSON file for analysis

This is the first time I have programmed something that I will actually personally use, so I am happy about that. I tried to write good code whilst applying functional programming concepts. So no ...
17
votes
5answers
4k views

Speeding up thousands of string parses

I have a mapping application which takes string arguments in the form of string arrays. I parse these and then perform an action on the map. One of these is ...
1
vote
2answers
44 views

Parse date format in Pandas using Python

I have a column in a Pandas Dataframe containing birth dates in object/string format: 0 16MAR39 1 21JAN56 2 18NOV51 3 05MAR64 4 05JUN48 I want to ...
4
votes
1answer
112 views

Email Generator

I've made a email generator, that uses a HTML template and replaces keywords in the template with information taken from a database. I'm looking to see if there is a way to improve the coding. ...
6
votes
1answer
85 views

Simple function to create Tokens from user input

I am new to programming in Rust and as an exercise I was making a simple Lottery checker program. It has a simple menu, the user enters a number for the corresponding option such as 'Add a line', '...
8
votes
1answer
144 views

Lazy, Functional Parser Combinators

Parser Combinators are the amazingly elegant way to write parsers that has evolved over on the functional programming side of the world, but have been less available or accessible for imperative ...
-2
votes
1answer
85 views

Parse header information [closed]

Concrete Context: I parse the header information from curl execution/request and get the array named $headerARR. At this point it looks like the next example, but ...
3
votes
0answers
47 views

Reading and parsing binary file from CAEN Digitizer (written by WaveDump)

Preliminaries I have CAEN Digitizer N6720A and use WaveDump software for the data acquisition and recording. As a result of data recording this software produces a binary file in which the sequence ...
3
votes
4answers
922 views

Optimize parsing more and more

I have the below C# code for parsing. Do you think this is most optimized or should I use a generic method in these functions themselves? ...
6
votes
2answers
112 views

Compact command line argument parser : Revisited

This question is a follow up to my previous one which can be found here. The user dfhwze suggested me to look into compiler construction and recommended me to write a lexer and a parser that would ...
3
votes
1answer
137 views

A simple TCP command executer

In https://github.com/pc-magas/tcp_command as an attempt to learn C++ I made a simplistic TCP server in GNU/Linux that will receives simple "commands" in ASCII form. Each command ends with '\n' and a ...
10
votes
1answer
312 views

Credit card validation in C

I am relatively new to C programming and I am currently working through the CS50 EDX course. The problem I have solved below is for week 1 (credit). Any suggestions on how to improve this code to ...
5
votes
0answers
64 views

Parsing Long Excel Report Files for Predefined Results

I work as an IT intern in a multinational and I was given a tedious task of combing through a 2500+ long multi-column excel report file in search of inactive servers. Here's a sample row from that ...
2
votes
1answer
75 views

Compact command line argument parser

So, I decided to write my own little command line argument parser for various other projects I work on. I am aware that there are many good command line parser libraries, but I did wrote my own anyway ...
3
votes
1answer
74 views

Parsing Game Entities

Could use some help with my presentation in Software Development. I'm presenting how I reworked a game's parser (SpaceTaxi). Basically we take in a .txt file with ASCII characters and convert them ...
5
votes
1answer
63 views

Try Parse Multiple Types

I am trying to write a method that takes in a String and returns an Object. The catch is I want to parse it to one of a few ...
3
votes
1answer
35 views

helper function to determine if html text is wrapped with a certain tag

I have this code that I've made to parse a string of HTML and tell me if it is all enclosed within a specified tag: ...
9
votes
2answers
115 views

Extract Information from Egyptian National ID

I did a script to extract information from the Egyptian national ID, e.g. national id is 14 digit ex(29501023201952). It could divide as described below: ...
6
votes
2answers
671 views

First attempt at dealing with command-line args

A little while ago I was fiddling with dependency-injection and came up with this small WPF application that I can launch with command-line arguments. Not only this was my first experiment with DI, ...
4
votes
2answers
4k views

Attribute Parser

This is a challenge question from hackerrank.com. We have defined our own markup language HRML. In HRML, each element consists of a starting and ending tag, and there are attributes associated ...
6
votes
3answers
250 views

Function to extract float from different price patterns

I've got a project where I get product data and need to get the prices which come in, in different formats. Some examples would be: US$17, USD17.00, 17,00€, 17€, GBP17, Only 17,-€, 17.000,00€, 17,000....
1
vote
1answer
51 views

Getting the count of how many times a route has been hit

I have this log file (example below) and I'm trying to find the number of times a particular route is called. Example log file: ...
9
votes
2answers
5k views

Math expression parser in C#

EDIT: Added refactored version 2.0 to the end! I have a parser that is supposed to take a string similar to a math expression and return a Tuple of: An array of strings where each string ...
4
votes
2answers
77 views

Simple INI file parser in Haskell

I've written a rudimentary parser for INI files: ...
5
votes
1answer
172 views

Recursive descent parser for simple arithmetic expressions grammar

What I'd like to see in your review, in order of relevance: Is there any bugs? (I see none, but...) Is the code efficient? (by whatever metric you'd like to use) Is the code easy to understand? ...
3
votes
1answer
72 views

Settings class implementation

I have a settings.txt file with the following format: ...
4
votes
2answers
87 views

Function to convert strings from hmmss, mmss, ss format to milliseconds

Here's the current logic to convert strings in the format hh:mm:ss, mm:ss or ss to ...
9
votes
2answers
526 views

Extracting the parent, leaf, and extension from a valid path

Powershell has the Split-Path cmdlet which allows you to extract the Parent and Leaf of a file. In PS version 6, you can extract the extension, with the ...
2
votes
1answer
63 views

Union based encoding of .csv file into a data table with different types [closed]

I am writing a program that has a row-based data table class. It also has an encoder class that is intended to take in some .csv data and convert it into a 2darray of encoded data of unknown type at ...
2
votes
2answers
65 views

Split calculation string into parts

Our professor has given us the following task (its part of a bigger document full of tasks): Write a function in C that handles strings like "233+343" and parse them into the variables "iNum1", "cOp" ...
5
votes
1answer
37 views

Analyzing a web access log to obtaining totals for requests

This program takes the filename as the input and outputs to a file the number of requests that were more than 1000 bytes and the total bytes. Log file example: ...
5
votes
2answers
98 views

Parsing parameters for a potential function

Background A forcefield is a collection of functions and parameters that is used to calculate the potential energy of a complex system. I have text files which contain data about the parameters for a ...
9
votes
1answer
129 views

Flight API querier

I am learning Go and wrote a small application that queries the Skyscanner API as my first attempt at learning. I was hoping someone more expert than me in the language could look over it at broad ...
2
votes
1answer
38 views

Determine if a String can be parsed to LocalDateTime or Int

I have the following kotlin function that takes in a string "value", then attempts to parse "value" as both a LocalDateTime and an Int. It returns a Pair of the parsed value of "value" and an enum ...
2
votes
1answer
70 views

Parsing expressions with combinators

I'm very new to Haskell's ReadP library, and the entire concept of parser combinators, so I was wondering whether there are better ways to do some things in this program: ...
7
votes
1answer
17k views

Parsing arithmetic expressions like (x + y * a + b *z)

I have this code which I wrote to parse arithmetic expressions. However, many people say there are problems with it but don't tell me what the problem is. Please let me know if you see any. Note ...