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
5
votes
2answers
41 views

Simple python string to list parser

So I came across this question on SO and I felt like it would be a cool thing to try and write a parser for since I always wanted to try it. So I present to you: My first time writing a parser. It ...
6
votes
0answers
25 views

Parse data from Input file and print results

I have written a script which does parsing to the input file and take out some values from them with respect to the node and print the data accordingly. Below is my script, and it works as expected: <...
8
votes
2answers
92 views

Text Parsing in C on a microcontroller

Microcontroller receive data on uart and call parser_i2c function when user presses enter e.g. parser_i2c(I2C scan) I want to parse following input from user communicated through uart I2C scan I2C ...
10
votes
2answers
488 views

Simple parser using Flex and C++

This is an alternative parser based on the specifications from this question. Briefly stated, the input file is a text file which has at least 33 fields separated by semicolons. If the fourth field ...
34
votes
6answers
5k views

Parser written in PHP is 5.6x faster than the same C++ program in a similar test (g++ 4.8.5)

I'm absolutely dumbfounded by this. I was trying to demonstrate to myself how much faster C++ is than even modern PHP. I ran a simple CSV parsing program in both that have the same output. The CSV ...
2
votes
0answers
18 views

Experimental parser based on a Tree of (String, Set a)

The parser function is immutable and is completely based on the forest of strings with associated properties (String,Set a). Changing the forest changes the behavior of the parser. The use of Data....
3
votes
1answer
71 views

Parser for AEC in C++

Many people tell me that C++ is a significantly better language for writing compilers than JavaScript is. So, I've decided to rewrite the compiler for AEC (the programming language I've made) from ...
3
votes
1answer
64 views

Parse HTML bookmarks file to JSON using python

I am currently working on a project for an online course, my goal is to create a bookmark manager web app. So I created this python script to parse a chrome/firefox HTML bookmarks file (Netscape-...
3
votes
1answer
44 views

Extracting average time series

I have this JSON code that I got from a get request with Azure API. Everything works how I want it but it doesn't look good. There must be an easier way to parse the data. ...
4
votes
1answer
119 views

Is there a better way to parse this data file?

I have a text data file in SPWLA format; I cannot find a specification for it. It contains physical measurements and/or rock descriptions from wellbore core samples. It's fairly gross. The example ...
6
votes
1answer
66 views

Tool for converting OEIS sequences into Desmos lists

https://github.com/CascadeIllusion/DesmOEIS Recently began work on a Python project called DesmOEIS to build up my portfolio. It's a simple console program that looks up integer sequences from the ...
2
votes
1answer
69 views

Library for parsing CSV data

Please review my C++ CSV parsing class. I have some specific questions: Should get_next_record be a static function? CsvParser ...
3
votes
1answer
63 views

C# Reflection-based CSV Parser

I've been trying to make a C# version of my Java CSV Parser using C# specific idioms. Here is the full code: ...
4
votes
1answer
63 views

A mathematical expression parser with custom data structures

I recently wrote a mathematical expression parser in C++. The software can read valid mathematical expressions and evaluate them. An example of an expression the code can parse is ...
3
votes
2answers
85 views

Java Reflection-based CSV Parser

I'm an experienced Java developer, however I don't have experience with reflection or Annotation classes. For fun, I tried to develop a CSV Reader class which can parse each row into a particular type....
2
votes
2answers
62 views

Finding pupils to tutor

I am a Math tutor and I found the site https://www.yksityisopetus.fi/ where one can search pupils. I made a Python parser to find pupils that want Math teaching with at least 25 €/hour. Are there any ...
5
votes
2answers
88 views

Convert Exponential (e-Notation) Numbers to Decimals

I have the following short function code that converts Exponential (e-Notation) Numbers to Decimals, allowing the output of large number of decimal places. I needed to cover all the e-notation ...
2
votes
2answers
55 views

String data manipulated given CSV variables

The Requirements: List the expensable items sorted by date and location given two variables: 'categories' and 'expenses'. The Categories variable provides the following information in order: Category ...
1
vote
1answer
63 views

C++ Code structure & Optimization: LR1Item

I've been working on an LR(1) parser, and I've just finished making the LR(1) item. I'm very rusty with C++, so any pointers (especially optimization and code structure) would be appreciated. Here are ...
1
vote
0answers
30 views

implementing parser - improvment

I have been trying to develop a program which implements a parser, i.e., syntactic analysis. Here is what I have done so far: parser.c ...
2
votes
1answer
75 views

Import huge XML data set into MongoDB while parsing data

I am currently working with the Stack Exchange Data Dump - to be more precise - with the dumped Posts.xml data set from Stack Overflow. What am I trying to achieve?...
2
votes
1answer
32 views

Parsing input in form of 'CMD NUM NUM' (num could be special char '%')

In the main() function of the following code, I wrote a very naive command parsing. Is there any more efficient way? This program is aim to deal with ADD, SUB, ...
4
votes
0answers
23 views

Listing my StackEchange communities user id

Extending this answer solution, I've wrote the following bash script to get the html of my StackExchange accounts page and parse it to a YAML file. The objective ...
3
votes
1answer
181 views

Java - parser for html-table

I wrote a program that saves the data from the first table of this wikipedia-article (in german) and then saves the column "Gesamt" (contains daily update of absolute numbers of Covid-19-infected ...
4
votes
1answer
69 views

How can this C++ json library be improved

I need a class to generate json content from data retrieved from a database. This gave me an excuse to play at creating a json library. This is my first attempt so it could probably be improved in ...
4
votes
1answer
51 views

A self contained parser generator implementation

This is a recreational project, I was trying to make a parser generator with a grammar inspired from: https://docs.python.org/3/reference/grammar.html Unfortunately, understanding that specific ...
9
votes
3answers
189 views

Performance - Read large amount of XMLs and load into single csv

I am dealing with a large amount of XML files which I obtained from here https://clinicaltrials.gov/ct2/resources/download#DownloadAllData. The download yields around 300.000 XML files of similar ...
3
votes
1answer
59 views

Tar archive parser - custom implementation

I'm learning python and for educational purposes I implemented tar archive parser. I'm not beginner programmer. I would like to receive some feedback and tips about code, what can I improve, what ...
0
votes
1answer
58 views

bad GNU libc argp code [closed]

In helpcovid git commit e27dd3b123c18300665 we have a stupid bug related to Linux GNU glibc argp program argument parsing. <...
2
votes
1answer
39 views

Reading bytes between two quotes from a stream and decoding it to its appropriate character set [closed]

This is a component for a lexer which operates on a byte input stream that handles reading and decoding the contents of a string contained within double-quotes. The validity of the encoding is handled ...
4
votes
2answers
767 views

Parsing a shop receipt

I've been working on a parser for shop receipts which extracts data about the payment. Here is the text that I'm parsing: * Vic107Payment Text: PINNEN TicketData: POI: 12345678 ...
2
votes
1answer
286 views

Parsing a TLV string

This piece of code is supposed to walk through a TLV string and print out its contents. For this particular example, tag field length is 2, size field length is 3. As a mostly C programmer, this is ...
5
votes
2answers
1k views

Python insert line in the middle of the file

I will be inserting a new text line in a setup.py file, this new line will contain text, and is part of the REQUIRED_PACKAGES. I ...
3
votes
2answers
66 views

Word bucketing in Python

First I'm not sure what this is called formally but whatever. Basically I need to form "wildcard buckets". I think the best way to explain what I need to do is to take an example. For instance, say I ...
5
votes
2answers
228 views

Evaluating arithmetic expressions and plotting graphs

I just got started with Python. I created some code, and I want to know what more experienced devs think about it. What can I do better? What to avoid? ...
2
votes
0answers
61 views

Parsing a Graph To Convert It Into Adjacency Lists And CSR And Then Make Connection Queries Using Bidirectional BFS

I was assigned an university project where I had to parse directed graph files coming from SNAP and then convert them into CSR (Compressed Sparse Row) format. Then the client must have the ability to ...
4
votes
2answers
138 views

INI config loader / saver

Please take a review of my simple .ini config loader / saver: ...
4
votes
1answer
108 views

Lexer written in Rust

So I ported a lexer I wrote in C++ over to rust, as I'm starting to learn rust. Since I'm very new though, I don't know any Idioms and good practices in rust. So if anyone could point out some (...
1
vote
1answer
75 views

Color highlighter / annotator in Haskell

I'm a Haskell beginner, and I wanted to make a color annotator or color highlighter, one which takes a text as standard input, and outputs that text, with its color words highlighted using the colors ...
2
votes
1answer
28 views

Parse Wavefront OBJ using ReadP

I've been reading Haskell tutorials and books for a while, but I never actually did serious stuff with it. This is my first attempt. It parses an OBJ-file in text format. Later on I will add some ...
1
vote
1answer
63 views

JSON-Parser written in Go

Below is a JSON parser written in Go. It's just a task I set myself in order to learn Go, which is also the rationale for reinventing this wheel. At the moment, it's not 100% complete but it can ...
6
votes
3answers
313 views

Make my XML Parser in Java using WoodStox run faster and use less memory, or just generally better

I have an XML Parser in Java using WoodStox that I wrote. This parser is going to be parsing through extremely large files, could be 5+GB. The goal of the parser is to convert a nest XML file into a ...
3
votes
1answer
69 views

Extracting event strings and message objects from Twitch IRC messages

I am looking for a better way to minimize nested if statements in my MessageHandler.handleMessage method. I am looking to adhere to SRP and a function should do one ...
9
votes
3answers
297 views

Recursive Descent Parser Implementation for a Recursive Language

I'm writing toy parsers for toy languages to understand how parsers work. Assuming a language as follows (in sketchy EBNF patois) ...
10
votes
1answer
130 views

Tokenize a string with escaping

I am learning C and therefore decided to build my own, little shell. Currently I am concerned with input parsing. I want to split a line of text into tokens with delimiters. But it should be possible ...
6
votes
2answers
453 views

C - manually parsing char* into integer

I'm trying to parse a char* into an int without using atoi(). I walk through the string, ...
27
votes
5answers
5k views

High performance txt file parsing

EDIT2: There is a summary below of the findings with new improved code and run time results achieved. Multi threaded follow up has been posted here. I find, in my daily programming, that text-file ...
0
votes
0answers
88 views

Simple React JavaScript Markdown Parser

I needed a simple Markdown parser for my purposes, such that I could turn a small subset of it (just bold, italics, code, links, and a custom poke you can click on) into React components (without ...
1
vote
1answer
40 views

Parsing HTML knock-off for answering queries for values

I wrote a code to parse an HTML knock-off from HackerRank, and I would like a review. Mostly I hope to get better at STL and code style. But any tips would be very welcome. Sample input that I would ...
1
vote
0answers
69 views

String parsing algorithm in Rust

I have written a recursive parsing algorithm for strings with nested brackets (I needed it to solve a molecules to atoms task). I would love to see how I could make ...

1
2 3 4 5
24