Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
33 views

Token generator for Valve Data Format parser in Java

I'm looking to parse a reduced subset of the Valve Data Format (VDF). It is similar to JSON, allowing representation of key-value collections (maps) with arbitrary recursion. As a small example: <...
0
votes
0answers
69 views

Algebraic data types in C++ [on hold]

After some exposure to Haskell I came to love ADTs to describe 'is one of' and tree-like structures. But now that I work with C++ a lot more I want to use them in C++ too. As far as I know I have two ...
4
votes
0answers
33 views

Wrapping argparse to use configuration file

I want to be able to both provide options through command line and from a configuration file. A single option could be served either by the user or by the configuration. But if is provided by both, ...
0
votes
0answers
42 views

Parse tokens into statements for compiling efficiently [on hold]

You can see the code here on GitHub but I am going to ask about one part, and that is the makeExpression function. ...
3
votes
3answers
78 views

if you gaze long enough into strtok, strtok will gaze back into you

The tokenise function below splits a given string at the indicated delimiters. As with strtok, it modifies the string by adding <...
9
votes
2answers
815 views

Parse and TryParse methods for phone numbers [closed]

Let's assume I have a class PhoneNumber which accepts phone numbers in the format "123-456-789" (3 groups with 3 digits each, split by dashes). Now, I want to ...
3
votes
1answer
26 views

Perl one-liner for parsing host names from ssh config file

Here is the working code (intended to be executed with perl -e '<code>' ~/.ssh/config): Actual version: ...
8
votes
2answers
435 views

Chemical Formula Parser

As an exercise, I wrote a simple context free parser modeled from a pushdown automaton for chemical formulas such as NO2 or ...
2
votes
1answer
39 views

A faux parser for fdf files

Introduction If you know what FDF files are, you can skip this section. PDF files sometimes includes form fields. These fields can be represented as FDF in plain text form, extracted using certain ...
1
vote
1answer
54 views

Creating objects from xml-data

I've got an XML file with some info about hosts connected to my home network and I would like to create objects containing that info in a neat way, so that I can make some nice front-end application ...
0
votes
0answers
30 views

XLSX to CSV script with column re-ordering

I am still learning Ruby and object oriented programming. I wrote an Excel Export CSV Parser script, which does the following: reads an XLSX file creates a temp file re-orders columns generates a ...
3
votes
0answers
80 views

C++ program that processes unique markup language similar to HTML

I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a ...
3
votes
1answer
64 views

Infix to postfix notation in Haskell (Shunting-yard algorithm)

I've written an infix to postfix converter in Haskell using the Shunting-yard algorithm. Example of how it works: ...
1
vote
0answers
32 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: ...
2
votes
0answers
24 views

Convert flat object hierarchy to json

I do work for a project currently, where the data is send to the server as application/x-www-form-urlencoded (which is bad, and it should be JSON, but unfortunately I am not able to change this one). ...
4
votes
1answer
67 views

Replacing Uri with a more convenient class

I needed some data structure for holding Uris so I thought I try the Uri class. It quickly turned out that it's very impractical because: it's missing an implicit ...
1
vote
1answer
38 views

Parse html bookmarks export to a json with python for further management

I made this piece of code as first step for a bigger project to iterate and manage bookmarks: open, rename, place in new folder structure, or delete each one of them. This first step is a parser to ...
3
votes
1answer
56 views

Generating report columns from SQL query

I've written this class to create RapportColumn objects for each column that is written in the query. And I would like to get your feedback. The query that is ...
6
votes
0answers
59 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 ...
2
votes
2answers
53 views

Parse IP address from a GPRS module reply

I'm writing a parser to get the IP address from a string I get from a GPRS module. Examples of the string I get from the GPRS module: +QIACT: 1,1,1,\"10.162.143.228\"\r\n\r\nOK\r\n +QIACT: 1,1,...
3
votes
1answer
128 views

COBOL layout parser in Python

I don't know anything about parsers but I had to write something to read COBOL for a work project. What are some things that I could improve with my Python coding and parser design? Note: This isn't ...
0
votes
1answer
100 views

Parsing messages with fixed-width fields into Employee objects

I'm writing a application that reads from a queue of messages from a legacy mainframe system. Some characteristics of message in the queue: Message from the Q is always fixed length plain text : 64 ...
2
votes
1answer
74 views

Parsing a C++ function declaration with Perl 6 grammar

I wrote a Perl 6 grammar to parse a C++ function. My final goal would be to parse an entire header. The aim is not to correct C++ syntax errors, but to parse valid C++. Do you have some advice or ...
4
votes
1answer
43 views

Search for ways in OpenStreetMap extract

What does it do ? Looks in big XML files (1-3 GB) for given parameters that I need in my project, appends them to lists and finally exports both of them to the CSV files. My XML scheme I need to ...
2
votes
0answers
42 views

DOS header parser in Rust

Looking for feedback mostly on the from() and printf() implementations but I included everything for context. Please do not ...
1
vote
0answers
86 views

Swift NMEA parser

I'm quite new to Swift, and although I've been programming as a hobby for many years, I'm still not very confident about my code. I'm currently rewriting an old library of mine, an NMEA parser. NMEA ...
3
votes
3answers
100 views

Parse a GET or POST string in C

This function takes a string from an HTTP POST or GET string, finds the specified variable, and allocates memory for the result and puts it in a string. The destination is given as an address of an ...
-1
votes
1answer
48 views

Remove lines from csv if duplicate value in column [closed]

i am trying to write csv parser so if i have the same name in the name column i will delete the second name's line. For example: ...
6
votes
0answers
95 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 ...
6
votes
2answers
114 views

Minimalistic, self-contained class for reading a sectionless INI file

When sections are ignored and no writing capability is needed, an INI reader becomes quite simple to implement. Here is my attempt at reading a sectionless INI file without any non-...
2
votes
4answers
165 views

Split a string into a list of tokens

I have the following assignment that I succeeded in solving, but the code is very inefficient. I would appreciate if someone could show me a more efficient way, perhaps with substring. Note that I am ...
0
votes
2answers
70 views

Convert HTML input string to JavaScript Array literal

I am trying to accept JavaScript array literals in an HTML text input. The problem is that HTML text inputs are captured as strings, such that an input of ...
6
votes
0answers
54 views

Minimal regex engine

A few months back, I posted a state machine for review. Thanks to the feedback, I was able to greatly simplify the implementation. I am posting the revised version, together with the Regex class which ...
2
votes
1answer
41 views

Count features in a file, using parallel code

When processing large files (say for parsing or performing computations based on the contents), we want to be able to use multiple processes to perform the job faster. In my case I wanted to count ...
-2
votes
1answer
54 views

Remove key-value pairs from string when only key is given

I have a need to parse strings that contain pairs of key : value, and remove a specific pair, when I'm only given the key. Example: Given the string ...
4
votes
1answer
37 views

Find labels in string in Haskell

I wrote code that parses a table header string in order to obtain two string tags, one for variable name (like GDP) and another for unit of measurement (like ...
4
votes
2answers
74 views

C++ string tokenizing without streams, with certain conditions

My concern is mainly the correctness of the algorithm for tokenizing purposes. The code compiles as it is called as a member function in my program. The code does pass my small amount of unit tests ...
2
votes
0answers
84 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? ...
0
votes
0answers
12 views

Abstract Parser and Rewindable Iterator [duplicate]

Since my last question didn't receive any contribution I decided to split it up. This is the first part. So for a Parser I decided I would need a 'Rewindable Iterator' which would allow for jumping ...
3
votes
0answers
52 views

Simple General Purpose Parser Implementation

This is an implementation of a general Purpose Parser/Matcher that can operate on any input stream of objects and will return all possible combinations. In this case I do not value performance that ...
4
votes
1answer
88 views

WiktionaryBot — A Discord bot for generating Wiktionary links quickly

I'm an active contributing member of Wiktionary and an active member of an active Wiktionary Discord server. Some time ago, several users proposed a bot which would make linking to Wiktionary in ...
2
votes
1answer
66 views

Crontab datetime field pattern parser in Rust

@angus on Unix.SE implemented a tool in C to list upcoming cron jobs in response to a question. I've re-implemented the basic functionality (showing only the next cron job) in Rust, using ...
2
votes
0answers
97 views

Multiformat text parser in Python

I am working on a small textract-based Python CLI tool that aims to extract text from either a single or multiple files, writing the output in corresponding text files. The input files can be of any ...
1
vote
1answer
165 views

Property file into configuration in Go

My first ever attempt at Go. Writing a small app. It takes a property file and uses it to populate a Config object. After adding the first property of the Config object (dateformat) I realised that ...
0
votes
1answer
102 views

Parse JSON strings as tables using Python

Needed a simple CSV file that had headers and no nesting of data to consume in Tableau. The JSON file I was consuming had nested dictionaries and lists (which sometimes had in themselves nested lists/...
2
votes
2answers
92 views

Processing lines in an event log to trace the status of a job

We have an event file which I'm processing to get the status of a job (process), whereas a single job contains multiple fields which I want to segregate based on what I required, for example, "...
2
votes
0answers
93 views

HackerRank Attribute Parser

I wrote a program for solving the Attribute Parser challenge on HackerRank. The challenge is to read some specified number of lines of HTML-like markup (each line no more than 200 characters; for any ...
0
votes
1answer
177 views

Match a simple balanced language using a queue

I asked a similar question here which is: The language L={anbn} where n ≥ 1, is a language of all words with the following properties: The words consist of strings of a’s followed by b’s. ...
9
votes
3answers
1k views

Match a simple balanced language

I apologise if the title is not very descriptive. If someone can recommend a clearer one I'll edit it. I have an exercise question as: The language L={anbn} where n ≥ 1, is a language of all words ...
4
votes
1answer
319 views

Use Infix expression to construct a binary expression tree

Problem statement Construct a binary expression using infix expression. The infix expression uses extra parenthesis to enforce the priority of operators. For example, infix expression ...