Skip to main content

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
51 views

Parser for a static interpreted programming language

...
Sohryuu's user avatar
8 votes
3 answers
2k views

is_decimal Function Implementation in C++

This is a follow-up question for is_number Function Implementation in C++. Considering G. Sliepen's answer and Harith's answer, I want to focus on decimal number here, therefore, ...
JimmyHu's user avatar
  • 5,392
3 votes
1 answer
55 views

Advanced String Calculator with asin, acos, atan Functions in C++

This is a follow-up question for Advanced String Calculator in C++. Considering the suggestions mentioned in MrBean Bremen's answer, I am trying to update the implementation as below. The experimental ...
JimmyHu's user avatar
  • 5,392
5 votes
1 answer
194 views

Parsing command-line arguments with getopt in C++

I did not find anything to parse command-line arguments in C++ (which was surprising), so I fell back to getopt() which has served me well in C (I am currently not ...
Harith's user avatar
  • 9,462
3 votes
1 answer
159 views

Advanced String Calculator in C++

This is a follow-up question for String Calculator in C++. Considering the suggestions mentioned in MrBean Bremen's answer and Martin York's answer. I am trying to modify the code and trying to ...
JimmyHu's user avatar
  • 5,392
4 votes
2 answers
142 views

String Calculator in C++

As a coding exercise, I am trying to implement a calculator which takes string as input, with addition (+), subtraction (-), multiplication (*), division (/) and power (^) functions. For example, ...
JimmyHu's user avatar
  • 5,392
4 votes
2 answers
667 views

is_number Function Implementation in C++

I am trying to implement a function which can determine a string is a number or not. Both positive and negative integers / floating numbers are considered. The experimental implementation ...
JimmyHu's user avatar
  • 5,392
1 vote
1 answer
52 views

Advent of Code 2022 Day 13 Solution in C: Sorting and parsing nested list

Link to Original Problem: Advent of Code 2022 Day 13 Question Summary: The task involves sorting and parsing nested lists, with two parts: Determine pairs in the correct order and calculate the sum ...
fish_brain's user avatar
1 vote
0 answers
133 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
8 votes
1 answer
587 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
186 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
93 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
836 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
60 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
112 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
159 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
98 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
0 answers
149 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
183 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
  • 9,462
2 votes
1 answer
181 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
  • 9,462
3 votes
1 answer
113 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
103 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
  • 9,462
2 votes
1 answer
113 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.9k
2 votes
1 answer
71 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.9k
2 votes
1 answer
109 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
158 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
74 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
148 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
518 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
107 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
531 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
100 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
742 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
121 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
360 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
  • 938
1 vote
1 answer
226 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
406 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
177 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
978 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
186 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
  • 77.3k
6 votes
2 answers
117 views

String unescaping in Dyalog APL

I am adapting the following existing python parser: ...
ohAitch's user avatar
  • 61
2 votes
1 answer
53 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
  • 475
0 votes
1 answer
99 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
431 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
265 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
686 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
  • 938
4 votes
1 answer
729 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
  • 938

1
2 3 4 5
27