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
2
votes
1answer
36 views

Parsing A Simple Matrix Definition In C

In one of my homework projects, I have to parse a matrix definition into a matrix data structure in C. The elements of the matrix will be given in a list of double. I need a simple tokenizer and ...
1
vote
1answer
82 views

Parse a selection of date formats

This Bash program parses day, month, year and month and year from arguments: ...
6
votes
5answers
242 views

Extracting a part of a URL path

I have a string like the one below from which I am extracting the tariff name. ...
3
votes
4answers
253 views

Convert number 1-5 from its spelt-out form

I'm working with an API that for some strange reason returns star ratings as words, like FIVE,FOUR,THREE,TWO,ONE. As far as I can see, there's no way to just get ...
1
vote
1answer
81 views

Python Fasta Parser using dictionaries without using BioPython or other external libraries

I am writing my own parser for fasta format. I can't use Biopython or anything else, because it's a part of an assigment and our teacher wants us to try to do it manually. For now, I have done this: <...
3
votes
3answers
410 views

Find the average score, given data in a table with labeled columns not in a fixed order

I was on Hacker Rank for the first time and there was a question that required to get the inputs from STDIN and use collections.namedtuple(). It was my first time ...
1
vote
1answer
79 views

Parsing data from different file formats

While setting up applications to communicate between various different trade partners and our WMS software I often have to parse very similar information from various different file formats. In this ...
4
votes
2answers
189 views

i3 config file parser

So I am using i3 an Linux window manager to manage my windows. In addition this is run on a laptop that is frequently mounted to several output-displays. This is handled by the following lines in my ...
3
votes
1answer
24 views

Bash argument parser with support for concatenated flags and '=' or ' ' between arguments and values

This is my best attempt so far at a bash script argument parser written without GNU getopt or bash getopts the first two ...
1
vote
1answer
67 views

using pandas and numpy to parse dirty .csv

I'm relatively new to Python have been writing for a few months now. I've started a Pandas Numpy project that starts with parsing large and somewhat sloppy formatted textfile, its not exactly csv but ...
3
votes
0answers
64 views

Python program that analyzes a corpus for randomword generation

I play a lot of old-school western CRPGs, and most of them (if not all) require the player to generate an avatar at the start of a new game, including naming the character (with names that will never ...
3
votes
3answers
93 views

PHP fetch an automated email, parse text for specific data, store, send summary

I'm new here. I recently found myself in charge of a large PHP-based system. The guy that wrote it produced some of the worst code I've ever seen. I've never been in charge and have had the luxury of ...
2
votes
3answers
107 views

Optimize lexer/parser bottleneck in C++

I am writing a parser for a custom mesh format for fluid dynamics simulation library, the mesh file contains 3D points (vertices) for the simulation mesh, for example: ...
1
vote
2answers
157 views

Parsing words from string

I am learning Java, so I am beginner. I know I can do this with split function but I want to improve my algorithm knowledge. I will be glad if you help me. Thanks. inputStr variable is contains the ...
2
votes
0answers
33 views

How could this indentation-based lexer be simplified?

I finally got this lexer working. How can the parse function be simplified? The goal is to take a tree of indentation-based text, and convert it into parentheses-...
4
votes
1answer
78 views

Small combinator parsing library in Haskell

I recently wrote code to parse lambda expressions written in a lisp like format, using a small hand-rolled parsing library. The goal This code was written as a part of this code-golf challenge not as ...
1
vote
2answers
79 views

Function to skip characters

A very simple function that can be used such that it returns a pointer to the first character on which func returned 0. However, ...
4
votes
1answer
50 views

Preprocessing invalid xml before feeding it to a parser

As part of a larger project I'm writing to learn C++, I'm trying to read through some almost-XML files generated by another program. Unfortunately this program uses its own custom escaping logic, so ...
1
vote
0answers
71 views

Yet another .ini parser for AutoHotKey

I decided to learn a little about AutoHotKey, to practice a little and learn about classes. I ended up writting a basic ini file parser. ...
1
vote
2answers
57 views

Extracting items from comma/semicolon-delimited strings, discarding parts after a hyphen

New Scala dev here. Is there a more idiomatic or efficient way to accomplish this in Scala? Given a list of the following strings, I need to obtain the unique 'main parts' once any parts including ...
6
votes
1answer
277 views

Parsing input and output currency names

The input for price() would be STRINGS, as you see below. If the string starts with "-" I would like what follows to be stored in fiat_name and then retrieve the symbol from ...
1
vote
1answer
40 views

Suggestions on making this parsing/unparsing format more human-friendly

I am working on some application which involves regular expressions with counting. Also, these regular expressions are not necessarily over some fixed alphabet, but over some class of predicates over ...
4
votes
1answer
68 views

Convert ASCII representations of phonetics to Unicode characters

Here is some working code for converting an input string to an output string: ...
0
votes
0answers
21 views

User input, floats, ints and ranges

Intro So I am writing a larger script where a part of it is checking user input. Maybe I have a menu where the user can choose different options, or maybe I want them to write in some number/s. After ...
5
votes
2answers
122 views

C key: value file parser

I implemented a key:value format file parser in C, or something that comes close to it as there is no such thing as dynamically creating structs in C. Assumptions: we are creating a C program that ...
3
votes
3answers
69 views

C string parser criticism

I have written a program to parse a string depending on the string the user provides. Any advise/criticism is appreciated. ...
7
votes
1answer
426 views

Count characters, words, and lines in files (wc in rust)

I wrote a barebones version of wc in rust. wc is a program that counts the number of characters, words, and lines in a file and ...
25
votes
4answers
4k views

Poor man's JIT using nested lambdas

While answering this code review question, I came up with a way to convert an equation given at runtime to a std::function<double(double)> that would evaluate ...
3
votes
0answers
65 views

Lisp expression parser

I'm building a very simple Lisp interpreter. Similar to the the one from here. Here is what I have so far for the parsing part, that is, everything from "text is passed to the the program" ...
2
votes
1answer
100 views

Parsing glider data from IGC files

I have to do a program in PHP that reads IGC files like this IGC file and gets records about the glider. For now I came up with something like this: ...
3
votes
2answers
1k views

Parsing a text file into a pandas DataFrame

I have a .txt file that looks like this: ...
6
votes
1answer
205 views

Calculator in C - Parsing arithmetic expression using the shunting-yard algorithm

This is a simple arithmetic calculator, which parses mathematical expressions specified in infix notation using the shunting-yard algorithm. This is one of my personal projects and I would love to ...
0
votes
0answers
91 views

Asynchronous web scraping

This is my solution to a "vacancy test" task. I'm not sure at all if I have correctly implemented the task, but here is my solution. Goals of code: Parse rows of table from a URL and ...
3
votes
1answer
44 views

Text replacement with Räubersprache ("Røversprog")

I've been toying with Haskell again and implementing a simple text replacement program that replaces all consonants c in a text by coc, i.e., inserting an 'o' in between: ...
3
votes
2answers
574 views

Separate an email address into its username and domain name

This is my first ever Python program and I wanted to get everyone's opinions on it. The goal of the program is to separate an email address into its username and domain name. ...
3
votes
2answers
130 views

Parse sequence of characters detecting formatting categories

I am a beginner coder and SonarLint tells me code is too complex. I tried recursion, iterators, slicing but had not luck making this code any simpler. The code will parse the input string to detect ...
8
votes
2answers
187 views

JSON4 parser in Typescript

Context I may have accidentally gotten a little sidetracked during homeschooling, and wrote a JSON4 parser in Typescript during the down-time. This project started as an idea that I got while ...
1
vote
0answers
54 views
1
vote
1answer
102 views

Company database REPL program in Rust for Chapter 8 of The Book

Using a hash map and vectors, create a text interface to allow a user to add employee names to a department in a company. For example, “Add Sally to Engineering” or “Add Amir to Sales.” Then let the ...
0
votes
2answers
84 views

Parse file and make output in custom List [closed]

I have a file output like this and want to do parsing and put the output into a List. The biggest problem here is the name of a wake-lock which appears after ID and runtime, in some cases, it contains ...
2
votes
1answer
67 views

Can this parser (concerning about infinite hierarchy of operators) be implemented purely in ReadPrec?

In Haskell, I tried to implement a parser for expressions containing hyperoperations, and finally succeeded. Valid expressions shall contain: Parentheses. Nonnegative integers. Addition represented ...
2
votes
0answers
105 views

Custom HTML parser in Haskell

For the last couple of months, I have started to learn Haskell and since I am following a course on functional programming soon, I thought I would test my current skills. So what I did was create an ...
10
votes
1answer
1k views

Parsing overly complex JSON

The Merriam-Webster Dictionary API at some point discontinued the use of XML in favor of exclusively returning JSON. This had the unfortunate effect of making finding a definition listed by sense ...
2
votes
1answer
87 views

Parse proxy strings to array of objects

The goal of this module is to take in a string (user input, someone copy and pasting a large list of proxies) and parse it into an array of objects. I appreciate any and all feedback, but I'm ...
2
votes
2answers
121 views

A postfix (a.k.a. Reverse-Polish Notation - RPN) calculator

As an exercise, I put together a postfix calculator using modern Fortran. Language apart, I am interested in knowing your take on the algorithm. As far as I remember from my freshman year (chemistry - ...
1
vote
1answer
54 views

Advent of Code 2020 - Day 3: tobogganing down a slope

Previous: Advent of Code 2020 - Day 2: validating passwords Problem statement I decided to take a shot at Advent of Code 2020 to exercise my Rust knowledge. Here's the task for Day 3: Day 3: ...
2
votes
1answer
43 views

Terminal Calculator/Parser Inspired by gcalccmd

My program takes input from the user in two ways: By passing input as an argument whilst calling the command By taking any number of inputs after calling the command The program is a terminal ...
3
votes
2answers
214 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 ...
1
vote
2answers
90 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
470 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, ...

1
2 3 4 5
26