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
2answers
33 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 ...
-4
votes
0answers
36 views

How to parse a POSIX command line pipeline in C

I've refactored this function that was 200+ rows. Now it is "only" 161 rows and I can do further refactoring now that I have a strategy. I fixed all the errors and memory leaks and measured with ...
3
votes
2answers
72 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
51 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
41 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
33 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 ...
1
vote
0answers
22 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
267 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
0answers
103 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
54 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
24 views

recursive descent parser

Here is a non-predictive recursive descent parser I wrote for the following grammar: ...
5
votes
1answer
62 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
58 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
69 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 ...
-1
votes
1answer
60 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
44 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
42 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
132 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
80 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 ...
1
vote
1answer
64 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
104 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
92 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
34 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
36 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
53 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
40 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
30 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
109 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
66 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
28 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
160 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
92 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
35 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
74 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
125 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
50 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
32 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
49 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
388 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
59 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
42 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 ...
3
votes
0answers
75 views

Expression parser using Shunting-yard algorithm

I've been working on a expression parser which will be part of another project (some sort of DSL). This parser basically uses the Shunting-yard algorithm, except for the case of parenthesis: here it ...
6
votes
3answers
184 views

Base converting with strings from bases 1 to 36 to bases 1 to 36

I'm writing a fastest-code challenge over at PPCG relating to base conversion of bases 1 to 36, and as a part of the process for writing the competition, I decided to write my own program for it. This ...
3
votes
3answers
82 views

XML parser using PHP

It is just one of the files. I have also tried to write some tests using PHPUnit. Please give me some suggestions to improve my coding-writing skills. The below is the test file for the above file: ...
2
votes
2answers
50 views

splitting multiple joined words, port from perl to PHP

Though i have never worked on perl, not even once. I have ported the perl code into PHP and it seems like giving a correct result. But as I am going to use it on production server. I want this code ...
1
vote
0answers
25 views

Expression parser in Haskell using operator precedence table

This is my first non-trivial Haskell project, an expression parser implemented using the Pratt Parser's technique for managing precedence as a layer on top of Parsec. It simply builds an expression ...