RubyParser.new.parse "1+1"
s(:call, s(:lit, 1), :+, s(:array, s(:lit, 1)))
Above code is from this link
Why there is array after + in the Sexp. I am just trying to learn ruby parser and the whole AST thing. I have been programming for a while but have no formal education in computer science. So do point to good article which explai...
Hi,
Does anyone know how to pars RDF file in Python to get all the values within a specific tag?
thanks
...
What is the difference between:
foo = TOKEN1 + TOKEN2
and
foo = Combine(TOKEN1 + TOKEN2)
Thanks.
UPDATE: Based on my experimentation, it seems like Combine() is for terminals, where you're trying to build an expression to match on, whereas plain + is for non-terminals. But I'm not sure.
...
I'm parsing sentences like "CS 2110 or INFO 3300". I would like to output a format like:
[[("CS" 2110)], [("INFO", 3300)]]
To do this, I thought I could use setParseAction(). However, the print statements in statementParse() suggest that only the last tokens are actually passed:
>>> statement.parseString("CS 2110 or INFO 3300")
Match...
For Data Explorer I would like to add support for a Batch separator.
So for example if users type in:
select 'GO' go select 1 as go
Go
select 100
I would like to return the three result sets.
Its clear that I need some sort of parser here, my hope is that this is a solved problem and I can just plug it in. (writing a full T-S...
I have strings like this:
"MSE 2110, 3030, 4102"
I would like to output:
[("MSE", 2110), ("MSE", 3030), ("MSE", 4102)]
This is my way of going about it, although I haven't quite gotten it yet:
def makeCourseList(str, location, tokens):
print "before: %s" % tokens
for index, course_number in enumerate(tokens[1:]):
...
Here is the code for my simple parsing application. I am getting an error that states 'No mapping exists from type System.Text.RegularExpressions.Match to a known managed provider native type'. This started to occur when I switched from using Split('_') to RegEx.Match for defining RNumberE, RNumberD, etc. Any guidance is appreciated.
us...
I'm writing a parser in F#, and it needs to be as fast as possible (I'm hoping to parse a 100 MB file in less than a minute). As normal, it uses mutable variables to store the next available character and the next available token (i.e. both the lexer and the parser proper use one unit of lookahead).
My current partial implementation use...
I am actually new to java programming and am finding it difficult to take integer input and storing it in variables...i would like it if someone could tell me how to do it or provide with an example like adding two numbers given by the user..
...
I cannot find any complete description about LL(*) parser, such as ANTLR, on Internet.
I'm wondering what is the difference between an LL(k) parser and an LL(*) one and why they can't support left-recusrive grammars despite their flexibility.
...
Ok, so I've asked a bunch of smaller questions about this project, but I still don't have much confidence in the designs I'm coming up with, so I'm going to ask a question on a broader scale.
I am parsing pre-requisite descriptions for a course catalog. The descriptions almost always follow a certain form, which makes me think I can par...
On the Last.fm website, your recently listened track include the 34x34 (or whatever size) image at the left of each song. However, in the RSS feed that they give you, no image URLs are provided for the songs. I was wondering if there was a good way of figuring out the ID for the image that needs to be used for that artist and displaying ...
Hi all,
I'm a bit new to Javascript and am trying to create a delimited string from a textarea. The problem is when passing in the textarea, it adds newlines for each row on the textarea. I need to have the entire textarea parsed into a string with a delimiter for each line (replacing the newline char). So for example, if you passed i...
Hello all,
I am trying to find all links in a div and then printing those links.
I am using the Simple HTML Dom to parse the HTML file. Here is what I have so far, please read the inline comments and let me know where I am going wrong.
include('simple_html_dom.php');
$html = file_get_html('tester.html');
$articles = array();
//fi...
Hi guys, the question is: suppose I have an input function like sin(2-cos(3*A/B)^2.5)+0.756*(C*D+3-B) specified with a BNF, I will parse input using recursive descent algorithm, and then how can I use or change Dijkstra’s algorithm to handle this given function? I need to execute it with sin | cos | sqrt | ln, where Dijkstra’s algorithm ...
from lxml.html.clean import clean_html, Cleaner
def clean(text):
try:
cleaner = Cleaner(scripts=True, embedded=True, meta=True, page_structure=True, links=True, style=True,
remove_tags = ['a', 'li', 'td'])
print (len(cleaner.clean_html(text))- len(text))
return...
I have a sample position file like below.
789754654 COLORA SOMETHING1 19370119FYY076 2342423234SS323423
742784897 COLORB SOMETHING2 20060722FYY076 2342342342SDFSD3423
I am interested in positions 54-61 (4th column). I want to change the date to be a different format. So final outcome will be:
...
Greetings,
I have a bit of code on one of my pages (note, I'm not the original developer nor an asp.net programmer) that looks like this:
<meta id="metaDescription" runat="server" name="description" content="SEE CODE BEHIND" />
<meta id="metaKeywords" runat="server" name="keywords" content="SEE CODE BEHIND" />
The placement of the "i...
I have a C# application that simply parses all of the txt documents within a given network directory and imports the data to a SQL server db. Everything was cruising along just fine until about the 1800th file when it happend to have a few blanks in columns that are called out as DBType.Decimal (and the value is usually zero in the files...
I am trying to parse a french date to a DateTime object with no luck so far. Is there a way? to do that.
String foo = "mar, 20 avr 2010 09:00:00 -0500";
I've Already tried parsing with a different culture and changing the culture of the thread.
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-CA",true);
Cult...