Questions tagged [parsing]

Use this tag for code that parses its input, or that is source for a parser generator such as yacc or lex.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Json4 parser in Typescript - Optimized

Context This review-request is a follow-up to this question. After the initial implementation, which focused on spec-compliance mainly, I have made some revisions to improve the performance of the ...
Patrick Hollweck's user avatar
-3 votes
0 answers
26 views

Retrieving n bits signed integers stored contiguously in memory [closed]

I'm trying to implement the minecraft protocol in TS/Node, and for the Position data type, the doc here says "x as a 26-bit integer, followed by z as a 26-bit integer, followed by y as a 12-bit ...
Fayeure's user avatar
  • 95
8 votes
1 answer
566 views

Command-line parser that takes a command in C

Explanation The reason I post this is that I am worried this code is clever, which is usually a bad sign. The command-line parser considers the following synopsis. ...
Schilive's user avatar
  • 243
2 votes
2 answers
164 views

Dimacs parser written in C++

I am a beginner in C++. I recently wrote a dimacs parser in C++ as a learning exercise. Can you suggest improvements in my code? ...
Sai Charan Marrivada's user avatar
1 vote
1 answer
81 views

Linux terminal like parsing

I'm creating a program that will hopefully operate like linux terminal (basic commands) for learning purposes. ...
depperm's user avatar
  • 937
5 votes
2 answers
804 views

A String View Library in C

I was recently working through the PintOS projects and became curious if there was a better way to do some string processing in C. Specifically, instead of strtok_r,...
Alex Lopez's user avatar
3 votes
1 answer
56 views

PowerShell Script for Parsing JSON PyPI Package Data and find the latest version

Following this post, I have a PowerShell script that aims to interact with the Python Package Index (PyPI) to find the latest release of a specified package that is compatible with the current Python ...
Foad's user avatar
  • 361
1 vote
2 answers
102 views

Compiler grammar and parser are disconnected

In the process of creating my first toy language, I have created the base grammar for it (which can surely be improved upon, feel free to comment). I am emitting C at the moment. \begin{align} ...
Tsaras's user avatar
  • 147
1 vote
2 answers
154 views

Strings to array

I've written a simple text tokenizer in JavaScript which works in my specific case, but I do not think it is maintainable (for example, if the requirement ever changed to allow newlines when ...
FromTheStackAndBack's user avatar
3 votes
1 answer
78 views

Creating an array (temporary table) in SQL and iterating through each row within this table to preform a check on the data in each row

The SQL Server version I am using is SQL Server 2008. I've got an SQL query/script I've written which is to help simplify some things while our API is being rebuilt. Essentially, this script allows ...
level42's user avatar
  • 131
2 votes
1 answer
118 views

PHP Parser and converter - SOLID and DRY

I am working on a PHP application that transforms data from the input CSV (JSON, TXT, or XML) into an output CSV (JSON or database, for example). The output format differs from the input: some columns ...
friday-json's user avatar
3 votes
1 answer
123 views

Parsing Java's class file

The structure of a class file consists of a single structure (presented here using pseudostructures written in a C-like structure notation): ...
Harith's user avatar
  • 5,719
2 votes
1 answer
152 views

Evaluate a prefix expression

The algorithm involves using two stacks. One stack (call it token_stack) holds the operators (like +, - etc) and operands (like 3,4 etc) and the other stack (call it count_stack) holds the number of ...
Harith's user avatar
  • 5,719
3 votes
1 answer
105 views

Multithreaded natural language text parser (Rev.3)

This is the third iteration of the Multithreaded natural language text parser code review. Special thanks goes to G. Sliepen who conducted the first two reviews. Before reading this post, please read ...
Damir Tenishev's user avatar
2 votes
2 answers
90 views

Evaluating Polish Prefix Notation and Polish Postfix Notation

In Polish postfix notation, the operators follow their operands. For example, to add 3 and 4 together, the expression is 3 4 + rather than 3 + 4. The conventional notation expression 3 − 4 + 5 becomes ...
Harith's user avatar
  • 5,719
2 votes
1 answer
105 views

Thread-safe strtok in C - version II

After improving Thread-safe strtok in C according to vnp's and Harith's nice comments, I ended up with this: Code strtok_arr.h: ...
coderodde's user avatar
  • 28.2k
2 votes
1 answer
67 views

Multithreaded natural language text parser (Rev.2)

This is the second iteration of the Multithreaded natural language text parser code review. Special thanks goes to G. Sliepen who conducted the first review. Before reading this post, please read the ...
Damir Tenishev's user avatar
7 votes
3 answers
1k views

Thread-safe strtok in C

(This post has a version II.) Since strtok is not thread-safe, I decided to practice and write a thread-safe replacement. This code and the demo runner may be found ...
coderodde's user avatar
  • 28.2k
2 votes
1 answer
102 views

Multithreaded natural language text parser

Could you please conduct code review for the code below and suggest some improvements? Functional specification Implement a multithreading parser based on existing natural language tokenizer. Parser ...
Damir Tenishev's user avatar
4 votes
1 answer
148 views

Natural language text fast tokenizer (Rev.5)

This is the next iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen, Toby Speight and uli who conducted previous reviews and to Matthieu M. and Adrian ...
Damir Tenishev's user avatar
3 votes
1 answer
70 views

Natural language text fast tokenizer (Rev.4)

This is the forth iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen, Toby Speight and uli who conducted previous reviews and to Matthieu M. and ...
Damir Tenishev's user avatar
3 votes
2 answers
128 views

Simple Python text file Parser and Converter

I wrote a simple text parser and a converter using Python 3.12.1. The purpose is to read a text file that contains 20000 words one per line, and create an output file that contains all the queries. ...
friday-json's user avatar
5 votes
2 answers
511 views

Natural language text fast tokenizer (Rev.3)

This is the third iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen, Toby Speight and uli who conducted previous reviews and to Matthieu M. and ...
Damir Tenishev's user avatar
3 votes
1 answer
103 views

Natural language text fast tokenizer (Rev.2)

This is the second iteration of the Natural language text fast tokenizer code review. Special thanks goes to G. Sliepen and Toby Speight who conducted the first review. Functional specification ...
Damir Tenishev's user avatar
6 votes
2 answers
512 views

Natural language text fast tokenizer

Could you please conduct code review for the code below and suggest some improvements? Functional specification Implement a function for fast tokenization of text in char[] buffer handling some ...
Damir Tenishev's user avatar
6 votes
2 answers
1k views

Advent of Code 2023 day 1: Trebuchet in C (part 2)

Problem description from the Advent of Code website: Part 1: The task involves analyzing a calibration document containing lines of text. Each line represents a calibration value that needs to be ...
virtualcode's user avatar
4 votes
1 answer
82 views

Parametric - a simple program argument parser

I've made a little header-only library for handling user input for console applications, I'd really appreciate it if you guys took a short look at it and told me what you think. The goal of the ...
Goubermouche's user avatar
4 votes
3 answers
2k views

A very simple config file parser in C++

I've implemented a config file parser in C++, which I may expand in future for personal projects. As of now the config file only supports floats, strings and booleans. The parser is based on various <...
Agent_A's user avatar
  • 73
7 votes
1 answer
730 views

Boolean conversion for fscanf()

In answering How to do file I/O with bool in C?, I made a helper function that used fgetc() calls to substitute the missing ...
chux - Reinstate Monica's user avatar
3 votes
1 answer
112 views

HTTP Request-Line parser

I am trying to write an HTTP/1.0 (RFC 1945) parser in C, so I started with the Request-Line. Ideally, the parser should return one of the three: The request is valid. The request is malformed, but ...
Schilive's user avatar
  • 243
3 votes
1 answer
341 views

C-style double expression parser

The purpose of this code is to parse any expression as could appear in C that involves doubles or functions that involve only doubles. I have written parsers before: Command line calculator in C ...
CPlus's user avatar
  • 928
1 vote
1 answer
187 views

A simple parser for bencoding format

I have been learning rust sporadically for a while now and decided to write some toy projects. While browsing https://github.com/codecrafters-io/build-your-own-x I came across some bittorrent client ...
Hakan Sonmez's user avatar
5 votes
2 answers
393 views

Parsing gateway ip from `/proc/net/route` in a docker container

In try to replicate the outcome of the following command sequence using php: netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10 I did this using ...
Dimitrios Desyllas's user avatar
2 votes
1 answer
167 views

Command-line parser with built-in error checking

Simple command-line option parser with automatic setting of variables and built-in error checking. The story is I was working on another new project that had a lot of configurable options, as they ...
Mode77's user avatar
  • 663
8 votes
2 answers
971 views

JVM bytecode instruction struct with serializer & parser

I am writing a java class file parsing & serialization library. As part of that i needed to implement a structure for the JVM bytecode instructions as well as come up with a way to parse & ...
p0sa's user avatar
  • 81
4 votes
1 answer
172 views

Tokeniser which yields a Range of string views

In my answer to string_view tokenizer function template I suggested that a flexible tokeniser would yield a Range that could be iterated over. This is my implementation of such a tokeniser. ...
Toby Speight's user avatar
6 votes
2 answers
116 views

String unescaping in Dyalog APL

I am adapting the following existing python parser: ...
ohAitch's user avatar
  • 61
0 votes
0 answers
50 views

Detecting the content type of a given http body/string

I am trying to detect the content/mime type of a given Buffer/string. In other words, I am trying to guess what on earth is a given string. My approach is somewhat brute-force: ...
Dimitrios Desyllas's user avatar
2 votes
1 answer
51 views

Parsing one UserData type to a preview

I am currently developing a web app and am using Spring as a Backend. I have some user data that is provided by one of our services and I need to display it in my frontend. The subject of the code ...
monamona's user avatar
  • 425
0 votes
1 answer
91 views

Retrieve data from an XML file in Java

few months back I did a code test for a company and I quickly managed to solve it within 5-10 minutes. But, I got rejected because it wasnt "good enough". What is good enough? they said its ...
Con101's user avatar
  • 3
7 votes
4 answers
428 views

Separating a String of Text into Separate Words in Python

Occasionally, we want to do a rudimentary parsing on English text; we separate the text into separate words. ...
Samuel Muldoon's user avatar
4 votes
7 answers
264 views

Breaking a string expression in operator and operands

Requesting for a code review for a scala implementation. Problem Given an expression string made of numbers and operators +,-,/,* , break it in a list of Integer or ...
vikrant's user avatar
  • 385
3 votes
3 answers
672 views

Command line calculator in C

This code is an arithmetic parser as is the code in a previous question of mine. However this parser handles floating point arguments and mathematical functions, and handles them without needing to ...
CPlus's user avatar
  • 928
4 votes
1 answer
707 views

Basic recursive descent parser in C

The purpose of this code is to evaluate simple integer expressions that make use of the C arithmetic and bitwise operators while respecting C operator precedence and parenthesis. I wrote this code ...
CPlus's user avatar
  • 928
4 votes
0 answers
170 views

constraint solving graduation using HTML Parsing, pandas, and z3

not sure if this project fits on code review, but my code is getting extremely messy, and would love some tips to clean it up! Overview The project is designed to take in an HTML file (a degree audit),...
retep's user avatar
  • 179
2 votes
1 answer
147 views

Powershell file parsing

I am using Powershell 7. We have the following PowerShell script that will parse some very large file. I no longer want to use 'Get-Content' as this is to slow. The script below works, but it takes a ...
Cell-o's user avatar
  • 295
3 votes
1 answer
241 views

ANTLR4 grammar for Conventional Commits spec

I would like to create a grammar for the Conventional Commits spec and I would love to hear any feedback for what I wrote. The spec has some ambiguities, I think, hence my usage of "island ...
Michael's user avatar
  • 133
0 votes
1 answer
75 views

Parsing shortcodes out of a string

I wrote this shortcode parsing and it runs in \$O(N^2)\$. Is there a way to better optimize this? ...
ericraio's user avatar
  • 151
1 vote
2 answers
341 views

Creating a dictionary from a word document using docx

I have a word document that contains alphabetical bullet points along with the key: value that I am trying to input into a dictionary using docx. Example: ...
Brendan S's user avatar
6 votes
2 answers
1k views

Read a large CSV order book

I am trying to read entries of my CSV file into an entries vector whose data type is object OrderBookEntry, which is an object that stores the tokenized variables ...
Beginner_coder's user avatar

1
2 3 4 5
27