I'm trying to extend the example grammar of PEG.js for parsing mathematical expressions with all the 4 operators for my online BASIC interpreter experiment:  http://www.dantonag.it/basicjs/basicjs.html  but not all the expressions are parsed corr...
How do you build an AST (Abstract Syntax Tree) for left-associative operators using PEG.js?  I've tried to write some code based on the information I found on the internet, but I seem to have made a mistake.  The code I wrote generates an incorre...
I have essentially the same question as PEG for Python style indentation, but I'd like to get a little more direction regarding this answer.  The answer successfully generates an array of strings that are each line of input with 'INDENT'...
I'm playing around with PEG.js  start = keyword  keyword = a:[a-z]? {return a.join("");}   Why am I getting here the error:     a.join is not a function   when I enter a valid string like abc?...
I'm trying to catch some text between parathesis with a semicolon in the end.  Example: (in here there can be 'anything' !"#¤);); any character is possible);  I've tried this:  Text  = "(" text:(.*) ");" { return...
I am having trouble defining an expression that allows any text between two tags (including those tags).  Examples:  #ifdef  asdasdasdasdasdsasd asdasdasdasdasdasdasd asdasdasdasdasdasasd #endif   It should also allow  #ifdef asdasdasd asdasdsad #ifd...
I'm new to the world of formal grammars. I tried to use ANTLR for JS but couldn't figure out how to run the parser. I'm trying to develop a grammar for a DSL on PEG.js and this is what I have (http://peg.arcanis.fr/3T2PKD/):  start    = e...
Given the input <outer> Content <inner> Inner <single/> </inner> </outer>.  How would I write grammar that parses the <single> node along with the nodes that have a matching closing node?  Here's my current gra...
getting a terrible headache after hours of trying to get this to work. I am using PEG.js parsing to get an input query parsed into an array. Right now im trying my best with this grammer. Operands and connectors are static and generated by the app....
I have an AST generated by a parsing expression grammar from a target language that will compile to a source language by traversing its nodes. A simple source like (10 + 20) * 2 should generate the following representation, as a native ECMAScript obj...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.