Skip to main content

Questions tagged [parsing]

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

2 votes
8 answers
786 views

Fail fast is brittle

I am creating a CSV consumer (with Java). There is one field / column that should contain one of the values "Rename" or "Move". I implemented this by allowing mixed case of letters,...
NimChimpsky's user avatar
  • 4,670
0 votes
1 answer
66 views

Concatenating strings given a BNF grammar

<Definition> ::= <Name> <LeftPar> <param> <RightPar> <Name> ::= <Letter><LetterTail> <LetterTail> ::= <Letter><LetterTail> | ‘’ A ...
User's user avatar
  • 11
1 vote
2 answers
121 views

How do I reduce number of FieldValidator derivations?

I am trying to write RSQL Parser which checks if the RSQL is logically correct. while the RSQL Java library checks whether the RSQL expression is grammatically correct, it doesn't check if the ...
Govinda Sakhare's user avatar
1 vote
2 answers
121 views

How do I solve this graphing dependency cycle in an AST?

I'm playing around with AST generation and exploring how it relates to a directed acyclic graph. I hit a logical snag that I don't understand. var literal = 3; // expression 1 literal = literal+1; // ...
NWoodsman's user avatar
  • 141
0 votes
1 answer
151 views

What lessons can be learned from the architecture/combination of ESLint and Prettier for linting and code formatting?

I was looking through the prettier docs and the prettier source code. It essentially has those defined helper functions to layout the text, given an AST. It operates on the level of the whole file, on ...
Lance's user avatar
  • 2,615
0 votes
2 answers
400 views

How Should Lexers Be Stateful?

Aside from modes, Antlr grammars can use "actions" which have to be written in the target language, sometimes seen used to conditionally push and pop from the mode stack. If I were to make a ...
SeriousBusiness100's user avatar
-1 votes
1 answer
116 views

Is it a good idea to let keywords have different lexical rules from names of types, variables, functions, etc? [closed]

For example, keywords have a special prefix. Objective-C has @interface, @implementation, but that's for compatibility with C. It inherits all the C keywords of course, with no @. How about a language ...
Eugene's user avatar
  • 117
-1 votes
2 answers
190 views

When writing a tokenizer, what is the standard practice for handling aliased language keywords?

When writing a tokenizer, what is the standard practice for handling aliased language keywords? For example, notethat signed short int is a language keyword in C++ and several aliases might be allowed....
Samuel Muldoon's user avatar
-1 votes
1 answer
202 views

Better way to represent grammar symbols in C

I'm trying to build a simple compiler for a subset of the C language in C. To achieve this, I needed to figure out a way to represent the grammar symbols. Basically, each symbol can either be a "...
Mehdi Charife's user avatar
0 votes
1 answer
461 views

How is it possible to store the AST nodes location in the source code?

I created a simple parser in Rust and defined the AST like this: enum Expression { Number(i32), BinaryOperator(Box<Expression>, Operator, Box<Expression>), Identifier(String), }...
Iter Ator's user avatar
  • 111
1 vote
3 answers
1k views

Parse 8 bytes to date time

I am trying to parse a file created by another software, but I cant identify a pattern on how this datetime is saved. There doesnt seem to be any consistency. Programming language of the software is C+...
rosi97's user avatar
  • 135
-2 votes
2 answers
157 views

How to filter and concatenate multiple sql files into one database [closed]

I have an issue where I have multiple databases from previous projects that I would like to combine into one large database. These databases are stored in .sql files. The issue is that I only need ...
ste's user avatar
  • 7
1 vote
3 answers
209 views

Using source code instead of XML/JSON or other custom serialization schemes and binary file formats

For a while now I have been toying with the idea of using source code as a file storage format. My question: How to support format version changes? (loading of older files with structural differences) ...
Reto Höhener's user avatar
0 votes
0 answers
222 views

What is it about kdb/q that makes the grammar not suitable for ANTLR style parser generators?

I want to build a code analysis tool for personal use when programming in kdb/q. In order to do this, I need to be able to parse q code into an AST. I have never written a parser before. ANTLR4 seems ...
Chechy Levas's user avatar
1 vote
2 answers
120 views

What do you call a process which transforms objects of complex types into simple objects of primitive types? [closed]

My first thought was that I'm "serializing" the complex object, but from what I understand that means I'm reducing it down to a string or binary format which could be passed over a network. ...
André Christoffer Andersen's user avatar

15 30 50 per page
1
2 3 4 5
20