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
3
votes
2answers
50 views

Python: Parse string of bracketed list items into list of strings

I have a string containing several items listed in the following notation: myString = '[A][B][C]' And I would like to parse that to a python list of several ...
0
votes
2answers
64 views

Parse Certain C++ Headers and Dynamically Generate Other Headers Containing Boilerplate Code

A link to the pull request in question. I maintain a C++ DLL / Game Maker library that constructs an environment that allows one to call any game maker script/function from within the C++ dll directly....
6
votes
1answer
122 views

Parsing a JSON one line at a time in Python

happy 2021 everyone! I started coding some months ago for fun and recently I challenged myself to build a JSON parser in Python (v3.8). The basic idea was to avoid loading the whole file at once, ...
2
votes
1answer
89 views

Simple Haskell Parser

I'm very new to haskell (I never used Monads, Functors and other things) and FP in general. I decided to write the simplest parser I possibly can with some expansion possibilities. (I have a general ...
3
votes
1answer
69 views

Parsing values from string into struct using match in Julia

My goal I am parsing from a string which contains token:value pairs into a type. Example: ...
2
votes
1answer
63 views

Extract values from English numerals, e.g. “nine million and one”

Though many have done it the other way around, I have not seen such code in many places. And, to be honest, I don't know why this cluster of if-statements, ...
0
votes
0answers
24 views

BNF for a number

I'm looking to learn and practice parsing, and so I have started with writing an EBNF for a number (using the python interpreter as an example of possible inputs). Here is what I have so far (also ...
2
votes
1answer
82 views

Message encode/decode library

I write protocol messages encoder/decoder for my project. All messages have 2-bytes header (1 byte - message type, 1 byte message sub-type) and body. There are two types of messages: Plain message - ...
3
votes
1answer
38 views

Decode alphabet encoded message

Inspired by another Q I finally made a version that groups permutable regions into parentheses. Non-ambigous sequences are outside of parens. Here the original problem: Given the mapping a = 1, b = 2,...
4
votes
3answers
85 views

Parsing “key: value” format in which values can span multiple lines

So I've written a function which parses a fairly simple key-value pair syntax. Each pair can span across multiple lines, as long as the value does not have a colon in it. If it does, then any new line ...
10
votes
2answers
291 views

Parsing a Chess FEN

What is an FEN? Link to the Wikipedia page: Forsyth–Edwards Notation An FEN is a very simple way of representing a chess position in a single line string. It contains the following data Which piece ...
3
votes
0answers
47 views

Simple single css node parser written in rust

I am new to rust and I wrote a little program that takes a part CSS selector and returns the name of the element and two vectors containing its attributes (classes, ids) Example div#menu.big.pink =&...
11
votes
2answers
142 views

A simple parser generator

I need to parse simple DSLs in a few projects. Since I don't know BNF or other grammars, I figured an alternative would be to use a simple parser generator. I'm looking for improvements to the lexer/...
5
votes
2answers
152 views

C# Logical and Math expression parser

I needed a simple parser that could do both logical and math operations expressed in a string, as well as being able to use variables stored in json. None of what I found online seemed to do all of ...
6
votes
2answers
151 views

Separating data from string representation of objects, with added extras

Given a string representation of data, I want to extract the information into its corresponding object. However, If the string has "|" separators then these should be considered options and ...
3
votes
2answers
28 views

Handle missing children nodes when parsing XML into a dictionary

I work on a code-base that uses xml to set up problems and specify model parameters. I've created a script that I run in tandem with our code. This script will ...
11
votes
3answers
369 views

FASTA-to-tsv conversion script

I worked on a script that takes as input a multi-sequence .fasta file and outputs the number of each aminoacid/sequence in a .tsv...
4
votes
2answers
75 views

Counting Characters from an HTML File with Python

I just completed level 2 of The Python Challenge on pythonchallenge.com and I am in the process of learning python so please bear with me and any silly mistakes I may have made. I am looking for some ...
5
votes
1answer
63 views

URL parser in C

Title should be self-explenatory. This is a simple URL parser I wrote in C. The function takes a URL from the user and produces a struct that contains the information that can be used to request the ...
7
votes
3answers
185 views

parse date and number from API results

I'm slurping up fields from an API that returns an array of fields. Each field in the array is a String that actually contains two separate fields (a number and a date). The number is enclosed in ...
3
votes
1answer
68 views

Parsing a url into host and path

I have a program which splits a url into host and path: ...
2
votes
0answers
32 views

How can I simplify my nom parser?

I'd like a recommendation on how I can improve the function unquoted_string below - specifically is there a better way to combine the parsers I have to achieve the ...
10
votes
1answer
216 views

Python molar mass calculator

I created the following program which takes a molecular formula as an input, eg CH3COOH and returns the molar mass of the compound: ...
2
votes
2answers
100 views

Parse python code, for specific pep8 issues

I am aware, that libraries exist for parsing python code, however, for the sake of learning how they parse errors, I'm creating a script that checks a file for only 6 Pep8 errors just for reference. ...
2
votes
1answer
51 views

Poor man's “about::tracing” for llbuild build time summary in JSON file

I used llbuild ninja build --profile PATH to create a JSON file of build summary in the following format: ...
3
votes
1answer
131 views

Parse selected records from empty-line separated file

This is my first post here and I hope I will get some recommendations to improve my code. I have a parser which processes the file with the following structure: ...
8
votes
1answer
220 views

Making argument parsing more streamlined and readable than if-statements

I am working on an API wrapper for calls to a website. Each of several types of calls can take a large number of optional arguments, some of which contradict. In the interest of preventing the user ...
2
votes
0answers
11 views

Prototype of a scanner/tokenizer for Bitmap Distribution Format parser

Instead of the obvious decision, parsing using given std::io::Lines/std::io::Bytes or crates like nom, I decided to explore ...
1
vote
0answers
88 views

Code refactor - eliminate generic interface and object methods

I'm building a method that tries to detect whether given information about an object's property to retrieve, a constraint operator and some data to compare it against, whether the result is true or ...
7
votes
2answers
87 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 ...
7
votes
1answer
95 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
119 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
596 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 ...
35
votes
6answers
6k 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
24 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
77 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
174 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
45 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
131 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
84 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
92 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
116 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
68 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
98 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
64 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
212 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
61 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
66 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
35 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
136 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?...

1
2 3 4 5
25