Analyzing (un)structured data to convert it into a structured, normalized format.

learn more… | top users | synonyms (1)

0
votes
1answer
5 views

“Fuzzy” parsing in different languages

I have a bunch of plain-text like this: 1 MILE, PACE, PURSE $1,100. FILLIES & MARES N/W $541 L5 STARTS AE N/A $301 L5 & N/A $60 PS IN 2015-16 DRAW INSIDE ...
2
votes
4answers
121 views

Is the var token necessary to signal variable declaration?

When creating a variable foo, Python lets you just write foo = bar. However many languages, like C# or JavaScript, require additional syntax like var foo = bar or foo := bar to signal the same thing. ...
0
votes
0answers
63 views

Parsing text with repeating blocks

I am parsing the responses from our Varnish load balancers in order to monitor the status of various nodes. One of the responses we get is text consisting of multiple blocks of data, one for each ...
1
vote
1answer
43 views

How to handle user created expressions in application

In our application users can enter custom expressions to calculate certain things. For instance they can specify an invoice and define a number of lines for cost calculation. Example for a course ...
0
votes
0answers
188 views

What is a lattice parser?

My friend asked me for help with his task: "Redeem a lattice parser with any programming language" - the problem is that he can't clearly explain me how the lattice parser should work. I've tried to ...
-1
votes
1answer
43 views

Tracking column (offset) in presence of tab characters

Imagine that you first write a compiler for your language where you necessarily report errors to the user. Compiler also collects location information for backend tools. They must know where the ...
2
votes
2answers
112 views

Regular syntax — what does it mean?

I am reading "Less is exponentially more" and there is a list of advantages of Go, first of them, quote "regular syntax (don't need a symbol table to parse)". What does it mean "regular syntax"? ...
1
vote
2answers
149 views

Declarative parser for JSON and DOM

I am parsing many JSONs and DOMs in PHP. The problem is that the my knowledge about the structure of the JSON/DOM is mixed with code. For example, suppose that I have few sources of first and last ...
4
votes
1answer
123 views

How to approach syntax errors when developing a lexical analyser?

I am writing an interpreted domain-specific language for my application. Each statement is parsed and executed as soon as lexical analyser decides that the end of statement is reached. It's handling ...
0
votes
1answer
87 views

Parsing conditional statements

I've written a small utility in Python3 to help me copy my music collection from my NAS to a mobile device. The usefulness of this is that it will auto-convert flac files to ogg-vorbis (to save space) ...
28
votes
4answers
3k views

How are comments usually parsed?

How are comments generally treated in programming languages and markup? I am writing a parser for some custom markup language and want to follow the principle of least surprise, so I'm trying to ...
0
votes
1answer
37 views

Is it a reasonable task to automatically convert ANTLR grammars to my own format?

I was working on my own parser generator tool in Clojure and then I realised I want to test it with some real programming languages. I can find a lot of existing language grammars only in antlr v4 ...
5
votes
1answer
132 views

quantitatively comparing AST shapes

How could one compare the shape of abstract syntax trees of similar source code programs (C, C++, Go, or anything compiled with GCC...)? I guess that plagiarism detection on source code would use ...
3
votes
6answers
222 views

In which layer I should implement file parsing?

in a simple multi layer architecture, in which layer do I have to implement something like parsing file. For example: I have a file and I have to extract specific information into an object. I think ...
1
vote
1answer
207 views

How should I handle the fetching of cached data in iOS

I'm developing an app at work, this is my first big application and in my smaller projects I didn't use caching at all. What's currently happening When the user logs on for their very first time ...
1
vote
2answers
108 views

Is recursive-descent parsing a panacea for DoS threats posed by 'Evil' regexes? Or does evilness stem from the grammar?

ReDos attacks exploit characteristics of some (otherwise useful) regular expressions ... essentially causing an explosion of possible paths through the graph defined by the NFA. So does using a ...
5
votes
1answer
270 views

How should I test the HTML output my class creates?

As a learning project, I am trying to create something similar to the WebGrid that comes with ASP.NET MVC. Now this component MyGrid<T> looks like this: public class MyGrid<T> where T : ...
2
votes
2answers
136 views

Incorporating functions into a Shunting-Yard algorithm implementation

tl;dr What would be a simple way of incorporating functions into a Shunting-Yard algorithm implementation? If only expressions like function(arg1, arg2, arg3) were allowed (where function is some ...
-1
votes
1answer
91 views

Global counter using iOS and Parse? [closed]

I'm very new to Parse and trying to set up what is basically a voting app where I can collect data on how many times all users have pressed a button. I found some information on Atomic Increment ...
2
votes
2answers
125 views

Algorithm to go from infix notation to a tree

I've been trying to figure out an algorithm to go from an infix equation to a syntax tree, like so: (1+3)*4+5 + * 5 + 4 1 3 However, I don't just want it to handle operators, I ...
2
votes
4answers
121 views

Clean Abstract Syntax Tree

I'm writing a toy compiler for fun. Basically, my problem is that I don't want to clutter the AST with stuff like debug information (symbol tokens, locations of tokens, etc) as well as data that the ...
2
votes
1answer
115 views

Mapping different XML and CSV feeds

Not sure if this is the right venue to be asking this but here goes. A little background. I'm trying to build an ecommerce app that would allow sellers from other venues--like, amazon and newegg--to ...
1
vote
2answers
125 views

Language/Programming term for paired delimiters [closed]

Can someone help me find the language and/or programming term for delimiters (?) that must be paired? Quotes, parenthesis, angle-brackets, square-brackets, etc. are often used to symbolize these ...
2
votes
2answers
208 views

“Hand written” recursive descent parser with “catch all” rule

I'm trying to write a (scannerless) recursive descent parser with a "catch all" rule for the following "Mustache template" grammar (simplified here): content : (variable_tag | section_tag | ...
1
vote
1answer
94 views

File validation rules

I have an application that can accept CSV files to run some operations. The files look like: CREATE USER:username,last_name,first_name,age user1,Smith,John,23 user2,Poppins,Mary,257 There are a ...
2
votes
0answers
66 views

Truncating HTML content at specific content blocks

I have HTML content in my DB and I would like to present a list of these individual items but truncate each of them so they're not fully displayed. I would like to keep truncated items ...
0
votes
1answer
157 views

Is it bad to implement a language in other two languages? [closed]

Ok, so I have some understanding about parsers and compilers, at least the basics of how it works, and i've written a calculator and a really small toy language that compiles to another high-level ...
2
votes
0answers
50 views

Argument over performance using Convert.ChangeType in Web Applications [duplicate]

A debate has been going on at work about using Convert.ChangeType. A couple of fundamental assumptions to this discussion are delineated below: 1. The discussion is within the context of web ...
1
vote
2answers
79 views

Passing context around AST nodes

I have various objects inside my AST, such as IfBlock, FunctionBlock, LogicExpression, etc. All of those objects share a context, which is basically a hashmap with some variables. It's a very simple ...
2
votes
1answer
137 views

Writing a parser on top of an XML-based AST: am i doing it right?

I have a sort of AST defined in XML that i'm trying to parse and evaluate. The XML tree contains the tokens and all the information i need. However, i'm finding it difficult to do it "properly". ...
1
vote
1answer
94 views

Run a c++ program under lots of different data maps

I want to run a c++ program to process a lot of data from different xml files and output results. I run the program once per file and potentially have around 50 different files. The trouble is each ...
0
votes
0answers
81 views

Matching groups of similar lines on a generic matching algorithm

I have to write a program to search through a file containing lines and find lines that match to a degree of tolerance but are not necessarily the same. So for example the following lines would match: ...
3
votes
1answer
213 views

Recursively parse without resorting to ugly design patterns

I'm currently building a crochet pattern parser in Java, and I've hit upon some trouble. I'll call the language used for input Crochet Pattern Code (CPC). I have a rather large writeup on the ...
1
vote
0answers
271 views

Calculating uncompressed file size without uncompressing file in zlib

I am writing a python program which parses zip (currently only zlib, using DEFLATE compression) files and verifies the correctness of their headers and data. One of the things I'm trying to achieve is ...
5
votes
4answers
524 views

When to use ANTLR and when to use a parsing library

I've always wanted to learn how to write a compiler - I've decided to use ANTLR, and am currently reading through the book (its very good by the way) I'm pretty new to this, so go easy, but the jist ...
0
votes
0answers
251 views

Writing Z80 table based assembler/disassembler

I have a long-term project: DIY computer with various processors. One of my wishes not only make hardware, but software too. So I started from assembler/disassembler for Linux, though there is a lot ...
1
vote
1answer
57 views

Can table of content be parsed using some formal grammar?

A table of content can look like: Preface Table of Content Chapter 1 ... 1.1 ... 1.1.1 ... 1.1.2 .... 1.2 ... Summary Exercises Chapter 2 ... ... Appendix ... A ... A.1 ... A.2 ... B ... References ...
2
votes
0answers
68 views

Loop Unfolding and Named Significant Bits

I've been writing a Parser Compiler for the last seven or so years, and I recently got to the point (yet again, never satisfied) of structuring the portion dealing with the portions of the language ...
0
votes
3answers
519 views

Why Double.parseDouble(“ABC”) not returns Double.NaN?

This code: Double.parseDouble("ABC") throws a NumberFormatException. Why is it wrong to expect a Double.NaN (NaN is literally Not-A-Number). A working example is this: public static void ...
-1
votes
2answers
2k views

What is the simplest and universal algorithm for parsing C++ code? [closed]

I need to do some project specific automatic checking of source codes written in C++ Limitations: Algorithm and its implementation should be simple, easily maintainable, extendable and ...
1
vote
0answers
2k views

Best practices to parse a log file using Python

I'm writing a Python tool to parse a log file from game server. The log file is of format: ms:classname::id::method::arg1::arg2.... There are a lot of classes, and a lot of methods for each class, ...
1
vote
0answers
68 views

Pre-Compilation Processor:

What I want to do: Parse source code, search for a beginning and closing tag of my own definition (one that does not conflict with any defined patterns in the programming language), and then replace ...
3
votes
2answers
497 views

Process to generate hierarchical structure based on relational data?

I have a csv of employee ids, names, and a reference column with the id of their direct manager, say something like this emp_id, emp_name, mgr_id 1,The Boss,, 2,Manager Joe,1 3,Manager Sally,1 ...
-2
votes
2answers
112 views

file quantity limit in a directory on a linux file server and why?

What is a good limit to use on the quantity of files in a directory, and why? EDIT: Why shouldn't someone create a system that puts hundreds of thousands of files in the same directory? Why I ask: ...
0
votes
2answers
244 views

BNF parsing rule for left associativity

Can someone please assist me with the following question. Write a BNF rule to parse into C -> E C -> E && E C -> E && E && E so that C generates as many E ...
26
votes
5answers
3k views

Name for this type of parser, OR why it doesn't exist

Conventional parsers consume their entire input and produce a single parse tree. I'm looking for one that consumes a continuous stream and produces a parse forest [edit: see discussion in comments ...
2
votes
2answers
335 views

Building a string parser for user command and control?

My goal is to build a command parser that has basic syntax and multiple possible branches at each point. These commands come from users of the system and are text input (no GUI). The basic syntax is ...
7
votes
2answers
749 views

In layman's terms, what is left recursion?

According to one page on code.google.com, "left recursion" is defined as follows: Left recursion just refers to any recursive nonterminal that, when it produces a sentential form containing ...
0
votes
1answer
65 views

What is latent parsing in NLP?

I'm reading a paper describing a NLP work, and I hardly catch the concept of a term, "latent parsing". Original paper: http://web.stanford.edu/~angeli/papers/2013-acl-temporal.pdf The figure in the ...
7
votes
1answer
1k views

Why did GCC switch from Bison to a recursive descent parser for C++ and C?

Was there a language change that required it or some practical reason why Bison was no longer appropriate or optimal? I saw on wikipedia that they switched, referring to the GCC 3.4 and GCC 4.1 ...