Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
38 views

I'm building a LALR grammar for a language where ">" can be either a) the greater-than operator b) the closing bracket of a "<" ... ">" construct (tuple literal) ...
Wiktor Tomczak's user avatar
1 vote
1 answer
76 views

I have a file contents. if the final line has a NL at the end, i get 2 token trees as expected, but of the file doesn't have a final NL, i end up with 3 trees which is unwanted. How do i get lark to ...
K P's user avatar
  • 13
2 votes
1 answer
79 views

I wrote this grammar to describe a simple patch procedure we use at work, operating on source code files. Engineers check in files of the form: {ignored space} //find_start {possible comment or ...
Ryan Brothers's user avatar
0 votes
1 answer
60 views

I would need to build a Tree that would retrieve something like this using Lark package: start expr or_expr and_expr comp_expr identifier Name comparator ...
francollado99's user avatar
0 votes
0 answers
30 views

I'd like to catch some word in text (say, "var"). So the rules rules = r""" start: expr+ expr: var | anything var.2: VAR anything: ANYTHING ANYTHING: /[\...
Igor Seliverstov's user avatar
0 votes
0 answers
49 views

Can one assign multiple aliases for a terminal or rule in Lark ? Consider the following grammar coordinate : "(" X "," Y ")" %import common.SIGNED_NUMBER -> X %import ...
Carel's user avatar
  • 3,417
0 votes
1 answer
91 views

I'm making early steps with the Lark library in Python and am really looking forward to replacing a lot of awful if statements with an EBNF parser..! The task here is interpreting the times written in ...
Jack Deeth's user avatar
  • 3,508
2 votes
2 answers
140 views

I have a processor trace output that has the following format: Time Cycle PC Instr Decoded instruction Register and memory contents 905ns 86 00000e36 00a005b3 c.add ...
ex1led's user avatar
  • 479
1 vote
0 answers
58 views

I would like to parse the following PlantUML which likes flow-charts, by using python lark package. The syntax of each action is based on verilog-hdl. PlantUML @startuml :[7:0] a; :write(reg01, 8'h01, ...
Asustor's user avatar
  • 21
0 votes
1 answer
127 views

I am new to lexers and parsers in general and to working with Lark in particular. I am using the versions lark 1.1.9 and interegular 0.3.3. I started writing a grammar which produces a warning when ...
xylophone's user avatar
1 vote
0 answers
40 views

I want blank new lines to be syntactically significant (optimization for leaf leaning trees [[[a, b], c, d], e, [g], f] == [a b | c d | e [g] f] but with \n\n instead of |). But the only way I can ...
Tom Huntington's user avatar
0 votes
1 answer
193 views

I dont want the func rule here, it's merely to avoid repetition. func: monad | dyad | builtin dyad: "{" dyad* func+ "}" | func+ ":" monad: "(" monad* func+ &...
Tom Huntington's user avatar
0 votes
1 answer
132 views

I have a (Lark) grammar that I think should be unambiguous, but depending on the version of Lark, fails to parse in one way or another: import lark syntax = r""" stmt: mov_stmt | ...
Jonathon Reinhart's user avatar
0 votes
2 answers
181 views

I defined the following grammar: from lark import Lark grammar = r''' start: ( bold_text | text) bold_text.2: "**" text "**" text.1: /.+/ ''' parser = Lark(grammar, ...
Jonas's user avatar
  • 3
1 vote
1 answer
161 views

I want to parse through a SQL Select Statement that has all the features a normal SQL dialect like MySQL has too. I looked for parsing libraries in python but couldn't find one that is doing the job. ...
Alexander Chereji's user avatar
1 vote
1 answer
256 views

So I'm definitely new to the concept and application of ENBF grammar and Lark in python. I'm having a bit of success but also am stuck on how to optimally do the next step of this project. To start ...
gigs's user avatar
  • 123
0 votes
1 answer
246 views

I am using python(3.11.5) with lark-parser. I am directly using the included python3 grammar, from https://github.com/lark-parser/lark/blob/master/lark/grammars/python.lark. I am facing an issue in ...
W1nTer003's user avatar
  • 237
0 votes
0 answers
612 views

Ok, so, this is probably a bit convoluted solution and I should probably use something simple, but it is what is. I have a huge text I want to parse using python's lark and I'm piecing together ...
thevoiddancer's user avatar
0 votes
3 answers
708 views

I want to parse an externally defined (and undocumented) file format in Python. It looks somewhat similar to TOML, but with different text styles, and no quoting. For example: [Schedule_Step122] ...
markfickett's user avatar
0 votes
1 answer
115 views

guys, this should be an easy one, but I can't figure it out. I have a text that I need to parse that dedents to non-0 column, like this: text = """ firstline indentline ...
thevoiddancer's user avatar
0 votes
1 answer
434 views

I am working on parsing formulas written in an internal syntax. I am working with Lark. Its the first time im doing this, please bear with me. The formulas look something like this: MEAN(1,SUM({T(F_01....
VicVic's user avatar
  • 63
1 vote
1 answer
358 views

I use lark to parse lines of a log file. The log file contains some equations and I would like to extract the left hand side and right hand side of the equations and store them in a dictionary. ...
user3389669's user avatar
1 vote
1 answer
914 views

In a grammar rule like the following one: top_rule: header? body footer? ?header: "DAY" DAY | "SECT" SECT ?body: BODY ?footer: "ENDING" | "...
ex1led's user avatar
  • 479
0 votes
1 answer
301 views

I'm trying to figure out how to use the Lark Python Module to parse a document that looks like this: ---> TITLE Introduction ---> CONTENT The quick Brown fox ---> TEST Jumps over ---&...
Alan W. Smith's user avatar
0 votes
1 answer
157 views

I am creating a parser with Lark. The parser works fine for most of the tests I ran, but failed with the define keyword. It only works if it is followed by an assignement. define a = 10 works just ...
Mstrdav's user avatar
  • 121
0 votes
1 answer
121 views

I've been tasked with creating a grammar for a legacy DSL that's been in use for over 20 years. The original parser was written using a mess of regular expressions, so I've been told. The syntax is ...
MerseyViking's user avatar
1 vote
0 answers
82 views

This is my first post on a community forum like stackoverflow so please forgive any mistakes. I am working in the field of program repair and unable to pass this roadblock. For every arithmetic ...
Ritik Taneja's user avatar
3 votes
3 answers
2k views

I am creating a REPL for Linux commands. Since my grammar for command is call: WS? (redirection WS)* argument (WS atom)* WS?, once the parsing is done, I always find whitespace is included as one of ...
plzfday's user avatar
  • 55
1 vote
0 answers
176 views

I'd like to implement a parser that helps me working on more complex boolean logic expressions for designing digital circuits. But I seem to be dumb. start:equation equation: SYMBOL | ...
Stefan Schmelz's user avatar
2 votes
1 answer
815 views

How do I modify this grammar so it matches parenthesis that are further away? ?wff: compound_wff ?compound_wff: biconditional_wff ?biconditional_wff: conditional_wff (SPACE? BICONDITIONAL_SYMBOL SPACE?...
Vivek Joshy's user avatar
0 votes
2 answers
1k views

According to AIMA (Russell & Norvig, 2010) this is the BNF grammar for FOL with Equality: How do I convert this to a lark grammar? Specifically, how do I represent n-ary predicates using lark ...
Vivek Joshy's user avatar
0 votes
1 answer
692 views

everyone. So, I'm parsing a shell output (mocked here) and I'm running into an error where I really don't expect. Minimum reproducible, working example is below: from rich import print as rprint ...
thevoiddancer's user avatar
1 vote
0 answers
856 views

Suppose I am trying to define a grammar for text like this (simplified example): foo=bar baz=x y=z The goal is to be able to parse, modify and write back data like this. I want to preserve whitespace....
evansrhonda's user avatar
0 votes
0 answers
520 views

I use the Lark library to parse boolean expressions like (A=(value1) OR B>(value2)) AND C<=(value3) and I also use it to parse keyless expressions like (A OR B) AND C the parser works ...
Zhihar's user avatar
  • 1,448
2 votes
1 answer
2k views

Question TLDR: I want to match anything but /.+?/ doesnt' seem to work, why? I have the following super simple grammar and code: from lark import Lark, Tree parser: Lark = Lark(r""" ...
Charlie Parker's user avatar
1 vote
1 answer
214 views

What's up. So, I'm having trouble getting more than one line to be accepted properly by the parser. from lark import Lark class SetLanguageLarkParser(): def __init__(self): self....
Stephen Rodriguez's user avatar
1 vote
0 answers
253 views

I have build a grammar for propositional formulas, however I have found that it is ambiguous, i.e., there is more than one derivation tree for my input formulas. This is the smallest ambiguous grammar ...
djimenez's user avatar
0 votes
1 answer
84 views

trying to create DSL to generate sequences ... here is what i did so far : ?start : expr token : WORD repeat_token : token ":" INT tokens : (...
sten's user avatar
  • 7,546
0 votes
0 answers
712 views

I'm trying to parse a simple sql via this grammar: grammar = ``` program : stmnt* stmnt : select_stmnt | drop_stmnt select_stmnt : select_clause ...
Spart's user avatar
  • 113
1 vote
2 answers
2k views

I'm using the lark parser with python. I'd like to use EOL as part of the grammar since it is line oriented. I'm getting an error when I try to put the regex in for matching EOL. I see some examples ...
kdubs's user avatar
  • 1,730
1 vote
1 answer
366 views

I want to be able to parse files in the Textile markup lanaguage (https://textile-lang.com/) in order to convert it to LaTeX. The file I have is a bit of an extension of Textile, since it adds fields ...
Jan-Jaap Korpershoek's user avatar
0 votes
1 answer
775 views

Following up from an earlier question, I'm a bit confused about the precedence of the /.+/ regex line; I would expect the below test to produce line line x chunk abc instead I get: line ...
RoyM's user avatar
  • 1,148
0 votes
1 answer
981 views

I'm trying to write a simple grammar to parse text with multi-line sections.. I'm not able to wrap my head around how to do it. Here's the grammar that I've written so far - would appreciate any help ...
RoyM's user avatar
  • 1,148
1 vote
1 answer
135 views

I'm using lark but can't figure out how I could match all players name as they can be complex with lark rules? Example pattern is "Seat {number}: {player} ({chips} in chips)" and I want all ...
na a's user avatar
  • 11
2 votes
0 answers
121 views

I am trying to define a simple grammar for C which I am using in Lark. The problem is, I defined the closing parenthesis ("}" or ")") as a terminal in the grammar but it is ...
ThunderLord's user avatar
2 votes
2 answers
945 views

This is a strange one, and it might be due to a python update, because it worked fine yesterday with no changes. Here we go: I have a program that opens utf-8 files (that use accented characters, etc, ...
algorev's user avatar
  • 29
0 votes
0 answers
166 views

I'm trying to parse using Python Lark the output of a plan from a database. Here's my grammar: start: op op: command "(" op ")" "[" text "]" | command &...
Antonis Karvelas's user avatar
1 vote
2 answers
759 views

I am trying to use lark to extract some information from perl files. For that, I need a basic understanding of what a statement is. The issue I came across are "Here Document" strings. I ...
user766308's user avatar
0 votes
0 answers
353 views

This is a follow-up question to my previous: Why do we need to specify the standard Lark lexer to be able to catch comment terminals? I need to "catch" and save comments in the DSL parsed by ...
Some programmer dude's user avatar
3 votes
1 answer
786 views

I'm working on a Lark-based project where I need to be able to "catch" comments in the code being parsed. However it doesn't work when using the standard lexer without explicitly specifying ...
Some programmer dude's user avatar