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
1 answer

Jison not assuming correct grammar

I'm creating a grammar in jison This is my jison file: sgr.jison /* AUX VARIABLES */ %{ var contratos = "(E1:ENTIDADE)-[C:CONTRATO] -> (E2:ENTIDADE)"; var dataArray = {}; function translateQuery(dataArray) { var finalQuery =…
0
votes
0 answers

How can I export a function from the jison parser to Angular?

so far I have been able to import the parser method as follows: import * as Parser from "src / assets / 1erJison / myGramatica.js" and everything works great doing the following **Parser.parse (input);** However, in the semantic actions, I have…
0
votes
1 answer

Jison parser generator shift reduce conflict with parenthesis, how to solve?

I'm trying to implement parenthesis in my parser but i got conflict in my grammar. "Conflict in grammar: multiple actions possible when lookahead token is )" Here is simplified version of it: // grammar { "Root": ["", "Body"], "Body":…
user13040728
0
votes
1 answer

Jison parser generator, shift reduce grammar conflict, how to solve?

I'm currently working on visual basic converter using jison, and I have these conflicts in my grammar: Conflict in grammar: multiple actions possible when lookahead token is ELSE in state 11 - reduce by rule: If -> IfBlock - shift token (then go to…
user12948478
0
votes
0 answers

How to get balance from the response retutned by AT?

I am using Africa's Talking sms services; I have implemented codes to check balance; but now how can I access balance value from this $response array? This is the result of var_dump($response). 'status' => string 'success' (length=7) 'data' =>…
Maji Mazuri
  • 55
  • 1
  • 8
0
votes
1 answer

Is it possible to programmatically set the state of a Jison parser in your JS code?

I'm writing a script in JS that utilizes Jison (https://zaa.ch/jison/) as the parser generator; I couldn't find anything in its docs that looks like the following: // index.js - the script using the jison parser let myParser =…
Vee
  • 729
  • 10
  • 27
0
votes
1 answer

Custom location tracking in jison-gho

I need to parse a "token-level" language, i.e. the input is already tokenized with a semicolon as a delimiter. Sample input: A;B;A;D0;ASSIGN;X;. Here's also my grammar file. I'd like to track location columns per-token. For the previous example,…
0
votes
1 answer

How to define variable in jison/bison

I need to store data in my jison variable and then retrieve the stored value and perform a simple arithmetic operation. I tried conditional operation and expression are working fine, but after I added a variable rule I got an error. My input…
Balaji
  • 9,657
  • 5
  • 47
  • 47
0
votes
1 answer

how to perform if and else statement in jison parser?

I need to perform math and conditional statement by jison,but problem is i am new to jison here so i attached my lex code below without conditional statment work good but when i attach conditional lex i got an error, i attached error too. /*…
Balaji
  • 9,657
  • 5
  • 47
  • 47
0
votes
1 answer

how to write custom function and variable in jison?

my lex code is /* description: Parses end executes mathematical expressions. */ /* lexical grammar */ %lex %% \s+ /* skip whitespace */ [0-9]+("."[0-9]+)?\b return 'NUMBER' [a-zA-Z] return 'FUNCTION' <> …
Balaji
  • 9,657
  • 5
  • 47
  • 47
0
votes
1 answer

JISON errors occuring with nonterminals

I am writing a JISON file for a class and trying to use nonterminals in place of declaring associativity for operators but am utterly lost on what the errors really mean, as this is a one time assignment for a class and I haven't found amazing…
Dakota
  • 59
  • 7
0
votes
0 answers

return n matched after a speific word in regex - JavaScript

I'm trying to get only 2 commas matched after a specific word match this is a test, fun(a, b, fun(a, b, another(a, b, c))) another(a, ,a, ,) I need it return only 4 commas (inside fun not another) matched instead all 11 /fun*(,)/ // I need to write…
0
votes
1 answer

Use custom functions in Jison

I'm playing around with Jison in order to add a new custom function. Starting with the example at Jison documentation: { "lex": { "rules": [ ["\\s+", "/* skip whitespace */"], …
fgalan
  • 11,732
  • 9
  • 46
  • 89
0
votes
1 answer

Defining Grammar for import statements for a jison generated css präprozessor languages

Im trying to generate a stylsheet parser with some extras to experiment with jison. How can I implement the import directive to load other files into the main file? I'm a little bit confused. Is there a way to use the lexer in the grammer file? Can…
user2502106
  • 101
  • 1
  • 9
0
votes
1 answer

With Jison, how do I scan right shift operator and nested generic type definitions

I'm working on a grammar for a language that supports the right shift operator and generic types. For example: function rectangle(): Pair> { let x = 0 >> 2; } My problem is, during scanning, the right shift operator is…
WaltersGE1
  • 813
  • 7
  • 26