Questions tagged [parsing]
This tag denotes challenges where parsing input is a large / the main part of the challenge.
248
questions
21
votes
19
answers
3k
views
Is it an Element?
𝖧ello all, I hope this finds you well.
There are 118 elements on the Periodic table at the moment, each one corresponds to the number of protons in an atom's nuclei.
Each element also has a 'symbol'. ...
16
votes
6
answers
3k
views
Is it a valid Go type?
Write the shortest program or function that will determine if an input is a valid Go type.
Spec
This challenge will use the following simplified subset of Go types. For more information, see the ...
16
votes
18
answers
2k
views
Get all URLs on an HTML webpage
This is a rewrite of the (currently closed) "Debunking Stroustrup's debunking of the myth “C++ is for large, complicated, programs only”" challenge.
Challenge
Write the shortest program or ...
10
votes
12
answers
1k
views
Calculate Bloons RBE
In Bloons Tower Defense 6, the strength of different bloons can be measured by their Red Bloon Equivalent (RBE), or the number of single pops it takes to completely defeat the bloon.
The RBE for the ...
11
votes
10
answers
2k
views
Parse a CSV file
In this challenge, given a CSV file as a string, you'll return the data contained as a 2d array of strings.
Spec:
The input consists of one or more records, delimited with ...
20
votes
12
answers
2k
views
Recognize a counting tree
Let a counting tree be a rooted tree in which every node is labeled with the number of descendants it has.
We can represent such trees as ragged lists with each node being represented by a list ...
13
votes
9
answers
1k
views
Translate to plorcly borglar
plorcly borglar is a "mod" created by jan Misali for the constructed language toki pona that makes words sound funny.
It involves substituting the 14 toki pona letters for funnier versions ...
10
votes
9
answers
866
views
Parse basic arithmetic into an AST
Introduction
An abstract syntax tree (AST) is a tree of tokens that shows their connection to each other and syntactical meaning. They are commonly used in compilers and static analysis tools, as ...
14
votes
7
answers
757
views
Implement Casio's M
The task
Most Casio calculators featured a variable M, which has 3 operators related to it: M, ...
7
votes
5
answers
822
views
Fastest Gematria calculator
Gematria is an ancient Jewish method to determine a numeric value of a letter sequence, using a fixed value for each letter. Gematria is originally applied to Hebrew letters, but for the context of ...
22
votes
22
answers
2k
views
Decipher a squashed sequence
Given a string containing a sequence of ascending consecutive positive integers, but with no separators (such as 7891011), output a list of the separated integers. ...
18
votes
25
answers
2k
views
Is it a valid list?
Given a string like [[[],[[]]],[]], made of only commas and square brackets, your challenge is to determine whether it represents a list.
A list is either:
...
15
votes
11
answers
783
views
Determine Uilta Pitch Accent
Uilta is a minority tungusic language spoken in the far east of Russia.
A neat thing about Uilta is that it has pitch accent which can be predicted by a computer program. In this challenge we are ...
39
votes
37
answers
6k
views
Eh, codegolf shmodegolf
This challenge is about implementing Shm-reduplication, originating in Yiddish, where one takes a word, duplicates it, and replaces the first syllable in the second word with "Shm" in order ...
24
votes
20
answers
5k
views
Is this expression Python 2/3 safe?
Given an expression like 4 / 2 + 3, determine whether the expression has the same value in Python 2 and Python 3. Recall that in Python 2 division rounds down (so ...
14
votes
5
answers
734
views
Is this propositional formula an instance of an axiom?
Please help me automate my discrete mathematics homework. Given a valid propositional formula, check if it is an instance of one of Łukasiewicz's axioms. Here's how it works.
A term can be defined ...
9
votes
5
answers
349
views
Convert the type modifiers from prefix to C-fix
Given a base type T, this can be augmented with * or [], each meaning pointer and array. For ...
3
votes
9
answers
1k
views
int, float or neither?
Given a string, determine if it is an int, a float or neither.
Examples
123 - int
62727.0033 - float
644c.33 - neither
Your code should output a different value depending on which it is. For example ...
25
votes
5
answers
1k
views
Ungolf my tinylisp code
I like golfing in tinylisp:
(d M(q((x)(i x(i(disp x)0(M x))0
But I also like posting explanations with nicely formatted code:
...
8
votes
4
answers
225
views
Split along groups (hard mode)
This is an alternate version of this earlier challenge with a twist that adds a significant bit of difficulty.
Like last time, you are going to be given a string containing some alphabetic characters ...
19
votes
10
answers
532
views
Split along groups
You are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into ...
14
votes
11
answers
716
views
AoCG2021 Day 20: Wonky license check
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2018 Day 8.
The license file for an imaginary software system is defined as follows:
The entire file is a ...
11
votes
3
answers
306
views
Is it a valid line in "Girls & Boys"?
Intro
Blur's song Girls & Boys featured the lines
girls who are boys who like boys to be girls
who do boys like they're girls, who do girls like they're boys
...
14
votes
15
answers
1k
views
Fully matched numbers
For the context of this challenge, a matched group is a digit \$n\$, followed by \$n\$ more matched groups. In the case of \$n = 0\$, that's the whole matched group. Digits only go up to 9.
For ...
16
votes
18
answers
960
views
AoCG2021 Day 11: Garbageful streams
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2017 Day 9.
Weekends are Bubbler's days off from posting these lol
A large stream blocks your path. ...
11
votes
16
answers
888
views
Cartesian literal notation
Introduction
In computer science, a literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values, some also have notations ...
27
votes
24
answers
2k
views
Convert prefix to infix
Infix notation is a method of printing mathematical expressions where each operator sits between its two arguments, such as \$ \left(5 \cdot 4\right) + 3 \$.
Prefix notation is a method of printing ...
2
votes
2
answers
210
views
Tips for parsing Standard Input in JavaScript
I've been doing quite a few code golf recently and I realised that a lot of times, I have to do something involving list.
Most of the times lists are space-separated or comma-separated values in the ...
29
votes
31
answers
3k
views
Open or Close the Parentheses
Every phone needs a calculator app. Because of the limited screen real estate, the developer of mine has decided to save some buttons. Instead of having two dedicated bracket buttons - one for open <...
19
votes
12
answers
2k
views
How many values of this type?
Background
The number of values for a given type is called the cardinality of that type, and that of type T is written as |T|.
Haskell and a few other languages ...
17
votes
22
answers
2k
views
Parentheses Clusters
Write a program that groups a string into parentheses cluster. Each cluster should be balanced.
Examples :
...
15
votes
8
answers
1k
views
Simplify K projections
Background
K functions have a feature called projection, which is essentially partial application of values to a function. The syntax for projections is a natural extension of the regular function ...
21
votes
31
answers
2k
views
Remove oddly nested substrings
Task:
Input will consist of some text, with nested [] separating some of it into nested groups:
...
11
votes
5
answers
492
views
Parse Ternary Lambda Calculus for correctness
Wheat Wizard has once tried to come up with a parsing problem unsuitable for regex, but it failed due to Anders Kaseorg's Perl regex answer. This is the second attempt. Now that we know that Perl ...
25
votes
5
answers
1k
views
Parse a lambda for correctness
The goal of this challenge is to fill a niche that is mostly lacking on this site. In my observations there most parsing verification challenges fall into two categories:
Super easy parsing. This ...
20
votes
5
answers
971
views
What if function application was right-associative?
Background
In Haskell and many other functional languages, function application f(x) is simply written as f x. Also, this form ...
27
votes
17
answers
1k
views
r flag my Vyxal
Vyxal is a stack-based language, meaning that everything operates by popping and pushing values onto a stack. It has a bunch of useful flags, one of which is r.
...
12
votes
4
answers
585
views
Leave the times out!
Everyone knows, that you can leave out the multiplication symbol (\$\times\$, or *) in
a*b
...
7
votes
3
answers
180
views
Distribute the additions!
Challenge: Given an expressions made of additions and multiplications, output an expression that is a sum of products. The output must be equivalent to the input modulo the law of distribution. For ...
51
votes
11
answers
4k
views
Write a C++ demangler
If you have ever looked at an objdump of a C++ program, you have likely seen something like this:
_ZN3foo3bar3bazI6sampleEE3quxvi3foo
This is a C++ mangled symbol, ...
15
votes
8
answers
2k
views
Visualize a Risky program
Risky is a new language of mine, which features an interesting form of tacit programming. In this challenge, you'll take a Risky program as input, and visualize the parsing.
No knowledge of Risky is ...
15
votes
14
answers
1k
views
Evaluation order of an APL n-train
From Codidact with permission.
Description
APL trains are a series of functions, that get applied to an argument in this way:
(f g) x = f g x here ...
20
votes
11
answers
4k
views
I'm Lazy: Close my Superparens
Picolisp has a feature called "super parentheses":
Brackets ('[' and ']') can be used as super parentheses. A closing bracket will match [all parentheses to and including] the innermost ...
13
votes
8
answers
1k
views
What is the link to your answer?
Goal
Your task is to create a program taking no input that returns the link to your answer. You can find a link to your answer by clicking at the share button on your answer.
Rules
Standard loopholes ...
10
votes
1
answer
306
views
CDGLF: TMN to APL
In this challenge you will remove one of my least favorite features, operator precedence from traditional math notation, to acheive the syntax of one of my favorite languages, APL. The APL subset we ...
18
votes
1
answer
667
views
Golfing Expressions
We can write mathematical expressions using the standard math operators (,),+,...
11
votes
6
answers
491
views
Approx how many search results
When one performs a search query using Google, one of the first things you see is an approximation of how many results were found. Today, you'll be simulating this in as few bytes as possible.
Input
A ...
8
votes
5
answers
820
views
Does this JavaScript function support keyword arguments?
JavaScript has no direct support for keyword arguments, but it supports argument object destructuring. It is standard to use a destructed final argument for keyword arguments. Here is an example:
<...
29
votes
10
answers
2k
views
Help Stack Exchange transpose tables
Stack Exchange doesn't know how to transpose tables. Let's help.
Given a markdown table, transpose it.
Input assumptions:
There will be at least two rows (including header) and two columns
Either all ...
23
votes
18
answers
1k
views
Interpret Interval Notation
Interval notation is a way to write complicated range bounds more conveniently and concisely than writing an inequality. The challenge, should you choose to accept it, is to write a program or ...