Are lexers and parsers really that different in theory ?
It seems fashionable to hate regular expressions: coding horror, another blog post.
However, popular lexing based tools: pygments, geshi, or prettify, all use regular expressions. They seem to lex anything...
When is lexing enough, when do you need EBNF ?
Has anyone used t...
Possible Duplicate:
Learning to write a compiler
I want to write a Compiler for C. This is a Project for my College i am doing as per my University. I am an intermediate programmer in C, with understanding of Data Structures.
Now i know a Compiler has the following parts:
1. Lexer
2. Parser
3. Intermediate Code Generator
4. O...
I have a source XML that uses a dot (".") as a decimal separator and I am parsing this on a system that uses a comma (",") as a decimal separator.
As a result, value of 0.7 gets parsed with Double.TryParse or Double.Parse as 7000000.
What are my options to parse correctly? One of them is to replace dots in source with commas with Stri...
I have a string of class string
string str;
how can I check if it is a number or not, str can only have 3 possible types described below like
abcd
or a number like
123.4
or a number with a parenthesis attach to the end it for example
456)
note the parenthesis at the end of "str" is the only possible combination of number and ...
I have a php code that works well in PHP 5.2 but throwing "Parse error: syntax error, unexpected '}'" after upgrading to PHP 5.3.
When I use echo/print or heredocs to print all the HTML part of the code, the error is gone.
My question is, why this error occurred? Is this mean that in PHP 5.3 we are no longer allowed to put HTML code in...
I am writing a small tool for analyzing simple B Machine substitutions as part of a college research work. The code successfully parse test inputs of the form mySubst := var1 + var2. However, I get a pop-up error message saying "This application has requested the Runtime to terminate it in an unusual way. " In the command prompt window, ...
Hi,
As part of the application we are developing (with android client and Django server) a json object which contains user name and pass word is sent to server from android client as follows
HttpPost post = new HttpPost(URL);
/*Adding key value pairs */
json.put("username", un);
json.put("password", pwd);
StringEntity se = new Str...
Hi guys, I am helping my nephew for his C lab homework, it is a string manipulation assignment and applying Wang's algorithm.
Here is the BNF representation for the input.
<s> ::= <l> # <r>
<l> ::= <list>| ε
<r> ::= <list>| ε
<list> ::= <f>|<f> , <list>
<f> ::= <letter>| - <f>| (<f><op><f>)
<op> ::= & | | | >
<letter> ::= A |... | Z
...
Another day, another strange error with SAX, Java, and friends.
I need to iterate over a list of File objects and pass them to a SAX parser. However, the parser fails because of an IOException. However, the various File object methods confirm that the file does indeed exist.
The output which I get:
11:53:57.838 [MainThread] DEBUG De...
My goal is to find the package (as string) of a Java source file, given as plaintext and not already sorted in folders.
I can't just locate the first instance of the keyword package in the file, because it may appear inside a comment. So I was thinking about two alternatives:
Scan the file word-by-word, maintaining an "inside-a-commen...
I have a report that we need to link (which we've checked to be working) to in a JSF project, the link looks like the following:
http://www.example.com/report/summary&rs:Command=Render
However when we try to load the page that links to it we get the following error:
The reference to entity "rs:Command" must end with the ';'
...
I've tried to understand a few examples, including questions here so I apologise if this seems to me a duplicate but I cannot find a RegularExpression I can understand.
I have some HTML to parse using an XML parser - but I want to strip out the <head> </head> tags from this content as the rest is valid enough for normal XML Parsing.
The ...
More specifically I'm looking for something, perhaps an add-on for firefox, once enabled it logs all of this information as it's passed to and from the server. I'm doing some web scripting and this would be really handy.
If anyone is wondering specifically what I'm doing currently I'm trying to make a script to repost my craigslist ad ...
I'm trying to parse a rss feed that looks like this for the attribute "date":
<rss version="2.0">
<channel>
<item>
<y:c date="AA"></y:c>
</item>
</channel>
</rss>
I tried several different versions of this: (rssFeed contains the RSS data)
println(((rssFeed \\ "channel" \\ "item" \ "y:c" \"date").toString))
But nothi...
Hey all. Java's XML parser seems to be thinking that my XML document is not well formed following the root element, but I've validated it with several tools and they all disagree. It's probably an error in my code rather than in the document itself, I'd really appreciate any help you all could offer me.
Here is my Java method:
private ...
I found a neat SVG parser at http://bkp.ee/atirip/ which parses an SVG file and outputs it into javascript that uses the Raphael JS library (raphaeljs.com). You'll notice in the source code at http://bkp.ee/atirip/svg2rdemo.php :
<script>
jQuery(document).ready( function() {
$("#c1").each(function(){
var c = Raphael(this, 19...
Are there ANY books (maybe even long tutorials) which cover making a basic, interpreted language?
...
Possible Duplicate:
Is there a string math evaluator in .NET?
Can C# parse mathematical expressions such as y=3*x + 3 into string? If so, ho?
I appreciate your help.
...
I am looking to replace from a large document all high unicode characters, such as accented Es, left and right quotes, etc., with "normal" counterparts in the low range, such as a regular 'E', and straight quotes. I need to perform this on a very large document rather often. I see an example of this in what I think might be perl here: ht...
Hi
I have problem with return XmlElement, who has value only firstchild of soap response.
Soap Response looks like this:
ResponseCode: 200 (OK)
Content-Length:537
Cache-Control:private, max-age=0
Content-Type:text/xml; charset=utf-8
Date:Tue, 18 May 2010 10:13:57 GMT
Server:Microsoft-IIS/6.0
X-AspNet-Version:1.1.4322
X-Powered-By:ASP....