Questions tagged [jison]

A parser generator for JavaScript.

Jison produces a parser from a context-free grammar.

Highlights:

  • Close compatibility with bison, lex and yacc grammars for lexer and parser definitions.
  • As the parsers it generates are plain JavaScript, they can be embedded in a web page executing inside the browser (similarly to OmetaJS, in that regard).

Resources:

Note:
There is the original Jison (AKA Vanilla Jison) that has not been updated lately and the GitHub GerHobbelt fork that is actively maintained.

139 questions
0
votes
0 answers

Is something bad with my grammar

I am using jison and I saw the documentation of ebnf grammars but I can't make my grammar works: Here are the images of my grammar, input and error In the error, the grammar is recognizing just one line but kleen star should recognize 0 to several…
Marilu
  • 1
  • 2
0
votes
1 answer

How to recognize repetition of tokens in jison?

TL;TR The objective of this exercise is to detect the repetition of a certain token, I am trying to do it with the symbol * coming from Regex, but it does not work. Problem description I am doing a basic transpiler, it consists in translating…
anlijudavid
  • 509
  • 6
  • 12
0
votes
1 answer

JISON tokens using same characters

I have some troubles using JISON. I am trying to match 2 strings in square brackets splitted by a dot. The problem I encounter is that if any of the strings starts with a number or minus, it detects it as MINUS or NUMBER [which is right], but I want…
Andrew
  • 18
  • 5
0
votes
1 answer

Resolving S/R conflicts in jison

I've written a very simple parser in jison, but there seems to be an S/R conflict in this grammar: /* lexical grammar */ %lex %% \s+ /* skip whitespace */ ":" return ':' "." return…
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
0
votes
1 answer

Jison grammar for jade-like syntax

I'm trying to implement grammar for jade like syntax with indent/dedent: div p id="text" But i got have problems with EOF: Error: Parse error on line 4: div p id="text" ----------------^ Expecting 'DEDENT', 'IDENTIFIER', got 'EOF' Grammar:…
Anton Medvedev
  • 3,393
  • 3
  • 28
  • 40
0
votes
0 answers

Tokenizing and parsing pairs of strings with Jison (or Bison)

I'm trying to build a parser with Jison (a node.js implementation of Bison) to parse a file that looks like this: --- Redirect Test Patterns --- one.html /two/ one/two.html /three/four/ one /two one/two/ /three one/two/ /three/four one/two…
adrianmcli
  • 1,956
  • 3
  • 21
  • 49
0
votes
0 answers

Bison shift/reduce conflict in simple call expression/lambda grammar

I've got a shift/reduce conflict that I can't figure out why it's occurring, and how to resolve it. Given this grammar: %token IDENTIFIER %start Expression %% CallExpression : Expression "(" ")" ; Lambda : "(" ")" "=>" Expression …
John Doe
  • 3
  • 2
0
votes
1 answer

JISON Recursion To read entire input text after a Token

I'm very much new to parser/cfg or jison. What I want my grammar to do is: Read everything after Token ADDRESS to EOF There can be multiple ADDRESS tokens between "ADDRESS TO EOF"(from step 1) My sample input looks like : ...abc xyz address 101…
Govind Mantri
  • 803
  • 1
  • 11
  • 24
0
votes
1 answer

Simple JISON parser to detect paragraphs

For GOD SAKE!! How to write a simple jison grammar that recognizes a document with paragraphs??? I'm using the following grammar: %lex %% (\r?\n)+\s* return 'NL' [^\S\r\n]+ return 'SPACE' . …
Bruno Fonseca
  • 33
  • 1
  • 5
0
votes
0 answers

How to "add" a parse error from an action in Jison?

Is there a way to add a parse error from an action in Jison? Say I have something like this: some_element : text '.' text { if ($3 === "SOMETHING3") // somehow add/throw a syntax error from here? } …
tkit
  • 8,082
  • 6
  • 40
  • 71
0
votes
1 answer

Why are my syntax errors in Jison not being "propagated"?

This is the code that I have: %lex %options flex %{ // Used to store the parsed data if (!('regions' in yy)) { yy.regions = { settings: {}, tables: [], relationships: [] }; } %} text …
tkit
  • 8,082
  • 6
  • 40
  • 71
0
votes
1 answer

Reduce/reduce conflict in clike grammar in jison

I'm working on the clike language compiler using Jison package. I went really well until I've introduced classes, thus Type can be a LITERAL now. Here is a simplified grammar: %lex %% \s+ /* skip whitespace */ int …
Vees
  • 703
  • 4
  • 9
0
votes
1 answer

Jison parser stops after first rule

I've got a simple file format that I want to parse with the jison parser generator. This file can consist of multiple expressions in arbitrary order and quantity. Here is the jison file for the parser: /* lexical grammar */ %lex %% \s+ …
tomvodi
  • 5,577
  • 2
  • 27
  • 38
0
votes
1 answer

How to generate a parser with JISON from a bison file

I am trying to write a parser for the Lilypond language of music notation in JavaScript. My first manual attempts work, but can only deal with a very small subset of the language. As Lilypond uses bison files to define its grammar[1] and JISON…
mauritslamers
  • 527
  • 3
  • 10
0
votes
2 answers

Is groff's grammar LALR(1)?

As a pet project, I'm trying to make a groff parser with Jison ( a JavaScript clone of Bison ), but I'm struggling my head trying to figure out if groff's grammar is LALR(1). Does anyone have an insight about this?. Thanks in advance. Update 1 In…
roperzh
  • 890
  • 7
  • 12