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.

learn more… | top users | synonyms (1)

1
vote
0answers
18 views

Shortcode parser in Javascript

I've written a naive shortcode parser in JS that parses shortcodes akin to those found in Wordpress. The intention is for this to be used in realtime on the client in order to preview edits on the ...
-5
votes
0answers
33 views

How do i check a year is a leap year or not from user input [closed]

I am doing an Object-Oriented programming with Java course in University. Where I have to program it by checking if a year is divisible by 4, if the year is divisible by 100, it is a leap year only ...
2
votes
1answer
15 views

Mathematical equation syntax tree

I'm writing these pieces of code to parse expressions in the context of a dice rolling application for DnD. It's pretty much my first try using TypeScript and I'm ...
0
votes
0answers
2 views

Most performant filtering method for nested XML using Google Apps Script

Assuming a theoretical XML hierarchical file exported from an analysis tool thus: ...
6
votes
2answers
117 views

ini file parser in C++

Please review my ini file parser (and potentially some general config file formats). The data structure used is a section, see below. Does that seem a good approach? I was wondering about the name. ...
2
votes
2answers
66 views

Enum for converting between field naming conventions

Based on this question and this answer, I decided to try the enum approach to do some more conversions I need in my application. This time I required to convert between the different field naming ...
3
votes
2answers
84 views

Parsing a string with named sections and a key-value pair on each line

I have a response String as shown below which I need to parse it and store it my class. Format is shown below: task name followed by this dotted line ...
1
vote
1answer
56 views

FIRST and FOLLOW sets calculator in Haskell

I found myself wanting to brush up on some notions about parsers and grammars and, at the same time, to exercise my Haskell - I am a Haskell newbie; moreover, I haven't touched the language at all in ...
2
votes
2answers
49 views

Shell command-line interpreter with pipeline parsing

Like many others I've been writing a shell command-line interpreter that can do a pretty decent pipeline parsing, first it splits the command at pipeline char (|), then it splits the substring at ...
2
votes
1answer
38 views

Pen-and-Paper Dice Roller Tool

A friend asked me to write a pen-and-paper dice roller, so I put this together. I'm still pretty new to Java Swing, so I was hoping I could have some advice on how I handled the layouts and ...
2
votes
0answers
26 views

PEG parser generator

I wrote a Python PEG parser generator that takes a grammar as a string, and returns a parser. The parser can parse its own syntax, and is feature complete with the original PEG paper, with some ...
4
votes
4answers
286 views

Data type detection for a CSV file parser

I am building a CSV file parser, and in order to get the appropriate Object to represent different data types found on the parsed files, I wrote the following function: ...
2
votes
1answer
134 views

Delimited file parser

This is some code I've cobbled together that reads a delimited file. If the user is able to tell us some stuff about the file, it uses the supplied information. Otherwise, it tries to work stuff out ...
2
votes
1answer
60 views

Parsing a string containing arithmetic operations in prefix notation

This is a piece from the complete program. What it does is parses mathematical expressions of the form (+(*3,x),5) to 3*x + 5 ...
4
votes
1answer
25 views

recursive descent parser

Here is a non-predictive recursive descent parser I wrote for the following grammar: ...
5
votes
1answer
66 views

run command pipeline in C

This code parses and tokenizes my shell language command interpreter. I will try and make it 2 functions, one that is the tokenizer and the other that is the rest of the function. Can you find ...
2
votes
1answer
62 views

Parsing in between of brackets

I do parsing of the string in order to find wrapped sub-string inside brackets of the first level. a+(b+(d-g))+g+d, in this case I will need to separate ...
7
votes
2answers
74 views

Parsing 4 Million Filenames

This is the next step in my project to query Companies House records. The first step, retrieving and validating the company numbers to be targeted, was covered here and I will include that code at the ...
0
votes
1answer
71 views

Tokenizing a shell command

I want to handle input like the following ls -al | awk '{print $1}' Now to parse it I couldn't tokenize at whitespace because of the quotations and I had to make ...
0
votes
2answers
46 views

Extracting data from a string

I created a method that takes a string value with a fixed length of 9 characters and extracts three values, house (4 characters), ...
1
vote
1answer
45 views

Parsing US addresses without regular expression for performance

Looking for some constructive feedback on Parsing an Address without using Regular Expression in C# for performance purposes. My aim is to clean the data and to separate it into its respective ...
1
vote
1answer
147 views

Parsing .PLY file using F#

I'm fairly new to F# and have written a program to parse PLY files - this is however done in an imperative way with mutable values and as far as I know that should be avoided in functional languages. ...
4
votes
2answers
92 views

Parse HTML to modify it

I'm using the following code to parse html, This code is working but since I'm new to JavaScript and working in alone project I would appreciate if you can give me some tips and feedback how can I ...
2
votes
1answer
20 views

tcl script to parse C++ source code for type identifiers

Experimenting with vera++ to validate some C++ source files. https://bitbucket.org/verateam/vera/wiki/Home vera++ is expandable by providing your own rules in tcl. To interface with the vera++ parser ...
1
vote
1answer
71 views

Parsing an address without regex [closed]

I am looking to improve on this code as it is not fully working properly yet. This address parse separates street number, street name, street type, apartment name and number from a string of a given ...
2
votes
1answer
106 views

Loading data from a text file into the database as fast as possible

I'm building a Django (1.8.12) application that parses a .bc3 file (Standard Interchange Format for Databases of Construction and Real State) and loads all the data into the database (PostgreSQL ...
3
votes
1answer
67 views

Parsing speech out of text

I'm working on an experiment to parse speech out of an emote in a text roleplaying game (MUD) so that if you can't hear it correctly, or if it's in a different language, you won't understand it. This ...
4
votes
2answers
99 views

Parsing a string as fast as possible that is using comma delimiters

I have made a simple static parser for a bigger program. This parser takes a string that has comma deliminators and I need to separate the strings in to a vector for handling in a different section of ...
2
votes
1answer
29 views

Read group of keywords from file, modify value, store new group to variable

I would like to use the following routine in my submission script for GAMESS calculations. I am not entirely sure if this is the optimum way to go. This function would need one of the messaging ...
4
votes
1answer
44 views

Extend API of complex source-code parsing CPAN module

I am working on a source line parser using PPI. After working a while, I realized that it would be nice if the PPI API had ...
2
votes
1answer
37 views

Simplified error handling when reading from stdin and parsing to a type

I've recently started learning Rust, and I've managed to whip up this function, which reads and parses a thing from stdin. I don't like it though, and I feel it ...
5
votes
1answer
54 views

`read` re-implemented for Int's

I have written a safe read function for haskell (for education!). I think this is fairly idiomatic haskell code, but I'd like to know for sure. If you see anything else that could be improved, please ...
2
votes
1answer
42 views

Getting the program's first argument as a number

I want to get the first argument as a number, if there is any. This does not feel quite right, but I don't know yet what the Rust way would be. I'm not searching for a args-framework or something, I ...
2
votes
1answer
32 views

Java class that parses Shoutcast stats XML

I have written a Java class that parses Shoutcast 2 stats XML. It uses JDOM to parse the XML. I have only basic knowledge of Java and I wrote this class in about 3 hours. It works, but I don't know if ...
7
votes
3answers
116 views

Prolog parser written in Haskell

I am writing a very simple Prolog intepreter in Haskell. It's a class assignment and I really want to do it right. I was able to (quite quickly) write a parser for the language. Today I borrowed a ...
1
vote
1answer
88 views

Converting an SVG polygon path from relative to absolute coordinates

This question was moved from StackOverflow as suggested by some users. I developed a function that aims to (should) provide a simple and effective method to transform a polygon ...
3
votes
0answers
31 views

Memory efficient Log Parser

I wrote this together for a test I'm doing that parses the Heroku access log. What I'm mainly interested is if this code follow common best practices and if there are any improvements I can make in ...
1
vote
2answers
167 views

Parsing two digits

This parses two digits and returns the rest of the string. Input: "20asg" Output: { number: 20, left: "asg" } Input: ...
4
votes
2answers
94 views

Reading file into structure

At the time I'm trying to read a quite big file into a C program for later user. The file size is in the range of 800 megabytes containing around 20 million lines of data of the following format: ...
3
votes
1answer
36 views

Putting a matrix from a text file into a list

I'm trying to read a text file with matrix and put it in a list, but I am using two loops here and I want my function to be faster. ...
4
votes
1answer
98 views

Parsing JSON using jsoncpp

I left questions in the comments strategically, since I think it's easier to answer questions this way. Basically what my small class does is abstracts away functionality that was originally in a ...
0
votes
1answer
131 views

Parsing JSON in one go using state machine solution

I need to parse a simple JSON string (flat JSON, no hierarchy) for keys and values, and there is a system constraint that I cannot use any built-in JSON library and can only read a string once due to ...
0
votes
1answer
60 views

Excel-to-JSON parser

I just wanted to build a simple converter from an XLS Excel file to JSON. I have predefined JSON format. All fields except of two - are just simple mapping from Excel to JSON. The two fields have a ...
4
votes
1answer
33 views

Using arrays to read in file, append it with parsed program output and overwrite original

Yesterday a friend of mine asked on U&L: How to optimize 'grep'-and-save? I will summarise shortly. The output of the torque pbs queueing system tool qstat ...
2
votes
1answer
61 views

Regular expression matching with string slice in Go

I have a slice of strings, and within each string contains multiple key=value formatted messages. I want to pull all the keys out of the strings so I can collect ...
5
votes
3answers
416 views

Parsing a complex number using regular expressions

Requirements were to create a constructor for a complex number, that receives a string. For example: \$3+5i\$. The regex extracts positive or negative numbers from the string with optional decimal. ...
1
vote
0answers
60 views

Email text parser

I am writing a parser to parse out the fields of an email message in the following format (note that I expect that the "To:" field could contain multiple lines, same with the "Subject:" field. ...
1
vote
2answers
34 views

Finding a delimiting character in a text file

I am writing a program that is capable of reading a matrix supplied from a text file. One intended feature of this program is that it should be capable of detecting various delimiters in the text ...
3
votes
2answers
43 views

Configuring fields to be extracted by a data processor

I solved this problem using closures with Perl and I wonder if/how I could/should have done it differently? Background: User creates config file describing properties of some source data file that ...