Questions tagged [jison]
A parser generator for JavaScript.
139
questions
3
votes
1
answer
110
views
Parsing an SQL-like micro-language which is a superset of Javascript
I am currently developing an application in Javascript in which I will allow the users to add "rules" to the application by the use of a small self-declared programming language. In order to ...
0
votes
1
answer
114
views
How can I get youtubeVideo Title from URL for android studio?
I want to get the youtube video title from a url so I found this code below (IOUtils) is depreciated any other way to do this
public class SimpleYouTubeHelper {
public static String ...
0
votes
2
answers
99
views
Remove ambiguity in grammar for expression casting
I'm working on a small translator in JISON, but I've run into a problem when trying to implement the cast of expressions, since it generates an ambiguity in the grammar when trying to add the ...
1
vote
0
answers
89
views
Syntax error in JISON with simple grammar
I'm trying to implement a very simple parser, but I'm having a problem. I have the following grammar:
%lex
%options flex case-insensitive
CaracterEscape [\'\"\\bfnrtv]
Escape ...
0
votes
1
answer
140
views
How to make a chained comparison in Jison (or Bison)
I'm working on a expression parser made in Jison, which supports basic things like arithmetics, comparisons etc. I want to allow chained comparisons like 1 < a < 10 and x == y != z. I've already ...
0
votes
0
answers
25
views
How to work with tokenized Bangla digits in Jison?
I am newbie at jison, using the following grammer with jison:
/* lexical grammar */
%lex
%%
\s+ /* skip whitespace */
[০-৯]+(?:\.[০-৯]+)? return 'NUMBER'
"*" ...
0
votes
1
answer
80
views
how to tokenize bangla digits as nunbers and work with them?
Salam❤️
I am beginner at Jison.
Learning small things day by day.
How I could work with Bangla Numbers with Jison?
I meant, How can I work with jison and use Bangla Digits as NUMBER token and work ...
1
vote
1
answer
83
views
Error while tokenizing Bangla Number(Digits) as Number token using RegEx
I'm new to Jison and I want to tokenize Bangla Digits ০-৯ as numbers. I've tried the regex below but it's not working with it:
Regular Expression: (^[\u09E6-\u09EF])+("."[\u09E6-\u09EF])\b
...
1
vote
0
answers
450
views
Parsing .aspx and .ascx files to use in a VSCode Prettier Plugin
I've searched with no luck to find a parser for .aspx and .ascx files that could be used to create a VSCode formatting plugin using the Prettier extension.
I've resorted to creating my own parser from ...
1
vote
1
answer
112
views
JISON: How do I avoid "dog" being parsed as "do"?
I have the following JISON file (lite version of my actual file, but reproduces my problem):
%lex
%%
"do" return 'DO';
[a-zA-Z_][a-zA-Z0-9_]* return 'ID';
"...
0
votes
1
answer
74
views
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
...
0
votes
0
answers
101
views
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....
0
votes
1
answer
113
views
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:
// ...
0
votes
1
answer
201
views
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 ...
0
votes
0
answers
36
views
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).
'...
0
votes
1
answer
124
views
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 ...
0
votes
1
answer
310
views
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 ...
0
votes
1
answer
570
views
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 ...
0
votes
1
answer
214
views
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 ...
0
votes
1
answer
188
views
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-...
1
vote
1
answer
138
views
Parse individual productions in JISON
In JISON, is there a way to parse a string for an individual production? For instance, this primitive parser defines a master expressions in terms of several productions such as ary.
Right now this ...
0
votes
1
answer
211
views
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 ...
0
votes
0
answers
58
views
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) ...
-2
votes
1
answer
485
views
How to include a Jison generated parser into angular?
With the Jison library one can generate parsers given a specific grammar like:
$ jison calculator.jison
As stated in [1] .
That would generate a parser calculator.js.
But how to include the ...
-5
votes
1
answer
486
views
How to include Jison into Angular?
How can one include the
Jison
javascript library into an angular project?
At the moment I'm getting:
WARNING in
./node_modules/jison/node_modules/source-map/lib/source-map/source-node.js
...
2
votes
1
answer
208
views
jison: how to add "require" in jison file?
I search online documentation but haven't found the way. For a rule like below (taken from the calculator example), I want to refer to external code.
expressions
: NUMBER
{$$ = new My....
0
votes
1
answer
172
views
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+", "/* ...
0
votes
1
answer
260
views
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 ...
0
votes
1
answer
64
views
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<Tuple<Float, Float>> {
let x = 0 >> 2;
...
3
votes
1
answer
1k
views
Making a parser to ignore a line comment, except a trailing comment
I am using Jison (Javascript version of Bison, very similar).
Objective
I want to parse an input and get valid tokens (IDENTIFIER and trailing comments)
My definition
IDENTIFIER
A word contains ...
0
votes
0
answers
88
views
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 ...
1
vote
1
answer
366
views
Using Jison to convert a list of commands into an array of objects
I am trying to use Jison, which is a JS port of Bison, the parser generator. My goal is to convert this input:
foo(10)
bar()
foo(28)
baz(28)
into this:
[
{ func: 'foo', arg: 10 },
{ func: 'bar' ...
1
vote
0
answers
257
views
Proper bison definition file for a multi-statement language with Jison
I am trying to get a handle on jison, which is a javascript implementation of Bison. My specific language I am trying to parse looks like this:
foo(10)
bar()
foo(20)
baz()
I want to parse this into ...
0
votes
1
answer
62
views
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 ...
0
votes
1
answer
126
views
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 ...
0
votes
1
answer
309
views
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 */
":" ...
1
vote
0
answers
110
views
Convert input string with jison
I have a function inside a string:
def sum(num):
end
And I want to convert it to:
function sum(num) {
}
using jison. I am using the grammar defined in a javascript object:
const grammar = {
"lex"...
1
vote
1
answer
150
views
Combine similar constructs in recursive rules
This is for a parser in Jison but I guess the same applies for Bison.
I have a rule that has a definition for an expression.
expr
: NUMBER -> { type: "number", value: $1 }
| "(" expr ")" -...
0
votes
1
answer
58
views
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"
----------------^
...
2
votes
1
answer
507
views
How to force shift in Yacc?
I have the following constructs as part of a yacc grammar (or rather jison, but the two share the same common base):
Type
: IDENT
| Type "[" "]"
| Type "*"
| "func" "(" Types ")" "=&...
0
votes
0
answers
255
views
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/...
0
votes
0
answers
326
views
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 "(" ")"
...
1
vote
1
answer
347
views
How to return multiple tokens with Jison lexer
I'm new to lexing and parsing so sorry if the title isn't clear enough.
Basically, I'm using Jison to parse some text and I am trying to get the lexer to comprehend indentation. Here's the bit in ...
0
votes
1
answer
127
views
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 ...
0
votes
1
answer
72
views
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]+ ...
0
votes
0
answers
136
views
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")
// ...
0
votes
1
answer
254
views
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: []
...
1
vote
0
answers
118
views
Parse character representation in Jison/Javascript
I'm coding a C++ grammar in Jison and I've managed to correctly detect character literals with this regex:
\'([^\\\']|\\.)\' return 'CHAR_LIT'
and then add it to the AST like this:
| CHAR_LIT
{...
2
votes
2
answers
580
views
How to detect new line in Jison?
I have a Jison piece of code that looks like this:
%lex
%options flex
%{
if (!('regions' in yy)) {
yy.regions = [];
}
%}
text [a-zA-Z][a-zA-Z0-9]*
%%
\s+ /* ...
2
votes
1
answer
398
views
Writing Bison grammar to recognise JavaScript functions and ignore everything else
I am trying to:
Read my JavaScript code through my grammar
Write a particular line inside the body of each function.
For example,
Input
function(){
console.log('this is some function');
}
...