Questions tagged [lark-parser]

Questions about the Lark parser project

Use this tag when asking questions about the Lark parser project (https://github.com/lark-parser/lark)

97 questions
0
votes
1 answer

Resolve ambiguity between strings and numbers in lark

I'm writing a grammar for a YAML-like serialization format. I'm using a LALR parser. I've hit a roadblock when parsing scalars. A scalar can be a string or a number (let's keep it simple and make it only decimals or floats). Here's what I have so…
d34n
  • 52
  • 1
  • 7
0
votes
1 answer

How to optimze grammar for Lark parser

My goal is to create a parser which can be used to parse DBC files. The syntax of the fileformat is given here. To achive this I choose the Lark-parser based on the excellent JSON parser tutorial. I created a grammar file based on the above linked…
handras
  • 1,548
  • 14
  • 28
0
votes
1 answer

UnexpectedCharacters Error when parsing for roman numeral using lark parser (ebnf grammar)

i'm using the follow grammar in lark-parser to parse alphabets and roman numerals. The grammar is as follows: DIGIT: "0".."9" INT: DIGIT+ _L_PAREN: "(" _R_PAREN: ")" LCASE_LETTER: "a".."z" ROMAN_NUMERALS: "viii" | "vii" | "iii" | "ii" | "ix" | "vi"…
snowflake
  • 902
  • 1
  • 6
  • 18
0
votes
1 answer

Getting shift-reduce conflict while parsing grammar

I am using LALR(1) parsing from lark-parser library. I have written a grammar to parse an ORM like language. An example of my language is pasted below: Table1 .join(table=Table2, left_on=[column1], right_on=[column_2]) .group_by(col=[column1],…
Prashant
  • 63
  • 3
0
votes
1 answer

Cannot get values from Lark AST

I cannot and do not know how to retrieve the values of an AST that I generated using the Lark parser. My grammar is as follows, saved in a .lark file : start: (un_handle ": ")? AMOUNT "|" p_handle ("," p_handle)* (" \"" MESSAGE* "\"")? AMOUNT:…
Willy
  • 322
  • 1
  • 17
0
votes
0 answers

How to feed lark with an antlr g4 C# grammar?

I would like to use lark to generate a parser for C# 6. I found a C# 6 antlr grammar but it does not work out-of-the-box with lark. Is there anybody who could tell me how to reformat the g4 grammar to something I can feed lark with? It seems that…
Natalie Perret
  • 8,013
  • 12
  • 66
  • 129
0
votes
1 answer

Python - Lark - Grammar - Can not generate AST

i am currently trying to generate an abstract syntax tree from a functional expression, which could be for example: OR(FunctionOne("valueA", "valueB", "valueC"), FunctionTwo("valueD", "valueE", "valueF")) Basically a simple concatenation of…
Creative crypter
  • 1,348
  • 6
  • 30
  • 67
1 2 3 4 5 6
7