Match maker

A challenge by Bulmenisaurus avatar Bulmenisaurus

Description

Given a CSS query, output the unindented html needed that will produce a match. For example, a.foo>b#bar should produce <a class=‘foo’><b id=‘bar’></b></a>

The html should have full tags, not self closing ones. The query follows the following grammar:

query   ::= element (">" element)*
element ::= name [id] class*
id      ::= "#" name
class   ::= "." name
name    ::= [a-z0-9]+

However for the test cases you should expect at most 9 levels of nesting elements.

Leaderboard

Author Score
#1 Mukundan314 avatar Mukundan314 145
#2 hallvabo avatar hallvabo 167
#3 Bulmenisaurus avatar Bulmenisaurus 168
#4 bizy-coder avatar bizy-coder 170
#5 ovs-code avatar ovs-code 171
#6 Jacob-Lockwood avatar Jacob-Lockwood 184
#7 NicknamedTwice avatar NicknamedTwice 186
#8 MeWhenI avatar MeWhenI 189
#9 Natanaelel avatar Natanaelel 192
#10 mousetail avatar mousetail 216
Challenge ends in 8 weeks, 0 days
You must be logged in to submit a solution.