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
4
votes
1answer
818 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 ...
0
votes
1answer
59 views

Nodejs Interview - API calls and exchange rate

I did an initial technical phone screening with this company which went ok, they then sent me a programming exercise to complete and send back to them. The goal of the exercise: -take input as a ...
1
vote
1answer
81 views

C - Argparse (Argument struct)

I'm trying to make something like Python's argparse in C. I created this Argument struct and functions; is my code good so far? ...
4
votes
1answer
90 views

Making a graph of the import structure of a program

When I read other people's code, it's sometimes difficult to understand the import structure. I thought making a graph of the import structure of a given python program would be a fun programming task,...
3
votes
1answer
161 views

Pytest fixture for testing a vertex-parsing function

I have just started using pytest and I am still getting used to how they do things. It seems like fixtures are at the core of the library, and that they can be used for making small pieces of dummy ...
2
votes
2answers
64 views

Parsing date strings, inferring the year such that the date is not in the future

I got this program that I am working on and in it, I got a section that has a try statement and two error except statements. ...
6
votes
3answers
198 views

Custom integer parser optimized for performance

I want an integer parser so fast it risks discovering time travel. I'm stuck in C# for a language, but that doesn't mean I can't try to use c++. So I wrote the following: The best I could do ...
2
votes
1answer
81 views

Sysinfo parser for a window manager status bar

The program is written mainly for the status bar in dwm (a window manager for Linux), but it can be used for any manager that takes input from the root window in X. It queries different resources in ...
6
votes
3answers
465 views

Custom double parser optimized for performance

I'm trying to beat the native Double.TryParse for performance in parsing large multi-million row (simple) CSV files as much as possible. I do not have to support ...
0
votes
1answer
43 views

Decompose big service class into small classes

Need to parse MongoDB collection and save parsed data into different postgres tables. MongoDB stores documents with different type field, for each type need to ...
3
votes
3answers
120 views

Safely & portably read a value into a predefined integral type of varying size like mode_t

I need to read a value from a text file and put it into a predefined type, in this particular case mode_t. This typedef can have a variety of types underlying it, ...
3
votes
1answer
121 views

Convert string to double and check for errors

The following program converts a string to a double, and checks for errors. It uses the strtod() function to do the conversion, and follows the example given for ...
2
votes
2answers
35 views

Algorithm that parses through input of points and finds distance

I'm wondering if someone could take some time to review this script. I'm parsing through a list of points of any length and calculating the distance. I'm wondering how to make my code better/more ...
4
votes
5answers
2k views

Implementing an alternative to scanf

Since almost all C functions designed to get data from stdin are bad / flawed: gets - the less said about this the better <...
0
votes
1answer
209 views

XML file parsing in Go

Below is a piece of code that is responsible for serializing files. ZL_LIST and PERS_LIST are XML file structs, I have not shown ...
7
votes
1answer
72 views

Configuration file parser

https://github.com/pixlark/vars-parser ...
8
votes
3answers
1k views

Templated CSV file parser

I want to parse a CSV file and store the data using the istream >> operator but I am running into big performance issues. Here is the current version: ...
3
votes
1answer
301 views

Convert *.VCF contact file for cellphone import

My new mobile phone is capable of importing contact information from a renamed *.VCF file stored on an SD memory card (https://www.quora.com/How-do-I-sync-contacts-on-Nokia-130). Annoyingly, it does ...
2
votes
0answers
95 views

A simple tokenizer in Erlang

I'm trying to learn Functional Programming and I picked Erlang because I will have to use it eventually. In the meantime, I'm trying to build a simple lexer to stumble upon problems and solve them ...
5
votes
1answer
96 views

Creating a dictionary of anagrams

I have a dictionary with about 4.2 millions of lines, each line contains a word (+some trash data I don't need) or whitespace. I need to convert this into a dictionary of anagrams (words that can be ...
3
votes
2answers
59 views

Extracting address information from non-formatted text

I'm pretty new to large projects, and usually my code is neat and manageable. But now that I'm about a month deep, things are starting to seem sloppy (or at least not aesthetically pleasing). Are ...
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 ...
5
votes
0answers
192 views

Python program to transform an Excel document, with some parsing

I wrote this to parse through an Excel doc, extract desired columns, parse certain cells and output another formatted Excel doc. This is the original Excel doc I have condensed most of the columns ...
7
votes
2answers
860 views

Trace route based on Cisco routing table text output

I created a script for path search across network topology based on uploaded routing tables in text format. The final purpose is to be able to get all available paths to given subnet/host from each ...
2
votes
0answers
606 views

Parsing XML file from the REST API

Please suggest how I can improve my code (like memory leakage, which pattern to use etc.). I have to parse a book XML in two ways: first from an FTP file and second from the REST API. I implemented ...
2
votes
1answer
61 views

Function that reads big files in C

I made a function that writes all the data from a hashtable to a .txt file and another to read the said data. The data comes from a this type of struct and it should be read into it when called <...
3
votes
1answer
187 views

CSV Reader from scratch

I am new to Java and not quite familiar with its design patterns. I have tried to implement a CSV-File reader from scratch. The CSVFile constructor accepts the path to the file and a class which ...
6
votes
2answers
358 views

Parsing small data into tuples

I'd like to make parsing small samples of data more efficient (from the developer point of view). This means, instead of writing the parsing logic each time from scratch when I encounter something as ...
2
votes
2answers
64 views

Parse and sort domain names and their prices

I set out to write a small Python script to tell me cheapest domains. I manually scraped for data from iwantmyname.com into a plain text file as follows: ...
4
votes
1answer
164 views

ASCII to uint16 using fallthrough

Introduction Watching this talk, I thought may be I could apply it on parsing smaller numbers, like std::uint16_t. I augmented it though, by using a fallthrough ...
7
votes
2answers
1k views

Python Prefix Notation Evaluater

I'm designing a new esoteric language, and the interpreter is in Python3. It is going to use Prefix Notation, so as part of the interpreter, I need a function that evaluates a string as prefix ...
1
vote
1answer
76 views

Parser for json-like format in PHP

At work they use a format similar to JSON but without quotes that looks like this: {foo:{qux:1,quux:0}, bar:{}} The reason they don't just use json is because ...
6
votes
1answer
863 views

Convert unsigned Integer to ASCII in x86 assembly

This is my best effort to code an x86 32 bits to get an unsigned int (4 bytes) and convert it into a string. My strategy was successively divide the number by ten and fulfill the remainder of the <...
3
votes
1answer
44 views

Finding the comic ID of the last XKCD comic published

I decided to sidetrack and create a XKCD viewer. For certain functionality, I needed to be able to find the ID of the last comic published. This was my attempt. I'm using Enlive here to parse the page ...
3
votes
3answers
168 views

Iterate over filename [closed]

My program inspects filenames which are delimited via underscores. So an example may be: This_is_an_example_of_my_filename.tif A counter example may be: This_is_a_very_bad_document.tif The ...
1
vote
2answers
102 views

Parsing NuGet packages.config with Parallel.ForEach

Below is a file parser for old style nuget package configuration files. The Parallel.ForEach is probably overkill; in most cases its fast enough without. However, ...
3
votes
1answer
842 views

XML Parser written in Java

Accepts a String (or a char array) as an input and stores the data in a tree structure. For example, given the input: ...
7
votes
3answers
4k views

Splitting std::string based on delimiter using only find and substr

I have been playing around with these two functions for a bit, dunno if this is practical though. I have only been learning C++ for a couple of days, coming from a Java background. There we had a ...
5
votes
2answers
635 views

Simple parser with regular expression

If I draw something in Illustrator and extract it with AI2Canvas I want it to be customizable so I wrote this simple program. It adds two variables: one to resize and one to shift the path coordinate. ...
4
votes
0answers
46 views

Parsing λ-terms using a very simple grammar

This is my first Rust program. It parses a string into a λ-term using a very simple grammar. Please evaluate style and use of ownerships / borrowing. ...
5
votes
1answer
234 views

Collecting YouTube links from a page

I wrote code for my needs (i.e. collecting YouTube links from a page) and it is simple, but now I just want to know what can I do just to make it a better and properly written one. For example, I ...
6
votes
5answers
3k views

String to double without std::stod

I encountered a pesky error in Code::Blocks: the conversions functions (stod, stof, stoi, ......
8
votes
2answers
618 views

Parsing oscilloscope binary data file with C++

Preliminaries I have OWON oscilloscope that is able to record waveform in file in three formats: Text format .txt: the first lines are some general information ...
2
votes
0answers
37 views

XML Input Parser To Load Test Data into Dev Database

I wrote an XML input transformer to ingest data from test directory and essentially store anything into a DB table. I attempted to make this as generic as possible. I'm new to Java and also realize ...
4
votes
1answer
274 views

Quadratic Equation Solver v2.0 in Javascript using Functional Programming

I have posted this in continuation to my earlier post Quadratic equation solver in JavaScript. Tried to improve on the shortcomings last time and also changed the logic. It is still not covering all ...
4
votes
3answers
859 views

Quadratic equation solver in JavaScript

The task is to implement a solveEquation function, which solves the Quadratic equation. Each equality has exact 2 integer solutions. Return those numbers as an ...
6
votes
1answer
71 views

Install Python script requirements

Sometimes I download a Python script (from a trusted source), and can't run it because of missing dependencies, which I have to install one by one (no ...
1
vote
0answers
215 views

A class to stop XML parser from converting UTF-8 entity hex characters

I'm trying to stop the xml parser from converting the UTF-8 enitity hex codes to its character alternative and also not adding the extra space in self-closing nodes after parsing. I've created a ...
6
votes
1answer
76 views

A simple BSON indenter / compacter

BSON is an extended JSON format. For example these documents are valid BSON documents, but invalid JSON documents: prettified documents: ...
1
vote
0answers
57 views

Flexible Image Transport System (FITS) file parser

I have a simple class which currently has some code in the constructor, which makes it difficult to inject and also test. ...