lexical-analysis

What can create a lexical error in C?

回眸只為那壹抹淺笑 提交于 2019-11-29 19:59:05
问题 Besides not closing a comment /*... , what constitutes a lexical error in C? 回答1: Here are some: "abc<EOF> where EOF is the end of the file. In fact, EOF in the middle of many lexemes should produce errors: 0x<EOF> I assume that using bad escapes in strings is illegal: "ab\qcd" Probably trouble with floating point exponents 1e+% Arguably, you shouldn't have stuff at the end of a preprocessor directive: #if x % 回答2: Basically anything that is not conforming to ISO C 9899/1999, Annex A.1

Does an algorithm exist to help detect the “primary topic” of an English sentence?

家住魔仙堡 提交于 2019-11-29 19:53:09
I'm trying to find out if there is a known algorithm that can detect the "key concept" of a sentence. The use case is as follows: User enters a sentence as a query (Does chicken taste like turkey?) Our system identifies the concepts of the sentence (chicken, turkey) And it runs a search of our corpus content The area that we're lacking in is identifying what the core "topic" of the sentence is really about. The sentence "Does chicken taste like turkey" has a primary topic of "chicken", because the user is asking about the taste of chicken. While "turkey" is a helper topic of less importance.

Algorithms or libraries for textual analysis, specifically: dominant words, phrases across text, and collection of text

无人久伴 提交于 2019-11-29 19:27:59
I'm working on a project where I need to analyze a page of text and collections of pages of text to determine dominant words. I'd like to know if there is a library (prefer c# or java) that will handle the heavy lifting for me. If not, is there an algorithm or multiple that would achieve my goals below. What I want to do is similar to word clouds built from a url or rss feed that you find on the web, except I don't want the visualization. They are used all the time for analyzing the presidential candidate speeches to see what the theme or most used words are. The complication, is that I need

Find out the position where a regular expression failed

大城市里の小女人 提交于 2019-11-29 13:34:58
I'm trying to write a lexer in JavaScript for finding tokens of a simple domain-specific language. I started with a simple implementation which just tries to match subsequent regexps from the current position in a line to find out whether it matches some token format and accept it then. The problem is that when something doesn't match inside such regexp, the whole regexp fails, so I don't know which character exactly caused it to fail. Is there any way to find out the position in the string which caused the regular expression to fail? INB4: I'm not asking about debugging my regexp and

How to implement Lexical Analysis in Javascript

落爺英雄遲暮 提交于 2019-11-29 08:02:42
问题 Hey folks, thanks for reading I am currently attempting to do a Google-style calculator. You input a string, it determines if it can be calculated and returns the result. I began slowly with the basics : + - / * and parenthesis handling. I am willing to improve the calculator over time, and having learned a bit about lexical analysis a while ago, I built a list of tokens and associated regular expression patterns. This kind of work is easily applicable with languages such as Lex and Yacc,

Does an algorithm exist to help detect the “primary topic” of an English sentence?

吃可爱长大的小学妹 提交于 2019-11-28 15:39:30
问题 I'm trying to find out if there is a known algorithm that can detect the "key concept" of a sentence. The use case is as follows: User enters a sentence as a query (Does chicken taste like turkey?) Our system identifies the concepts of the sentence (chicken, turkey) And it runs a search of our corpus content The area that we're lacking in is identifying what the core "topic" of the sentence is really about. The sentence "Does chicken taste like turkey" has a primary topic of "chicken",

Algorithms or libraries for textual analysis, specifically: dominant words, phrases across text, and collection of text

╄→гoц情女王★ 提交于 2019-11-28 15:01:33
问题 I'm working on a project where I need to analyze a page of text and collections of pages of text to determine dominant words. I'd like to know if there is a library (prefer c# or java) that will handle the heavy lifting for me. If not, is there an algorithm or multiple that would achieve my goals below. What I want to do is similar to word clouds built from a url or rss feed that you find on the web, except I don't want the visualization. They are used all the time for analyzing the

Find out the position where a regular expression failed

两盒软妹~` 提交于 2019-11-28 07:09:59
问题 I'm trying to write a lexer in JavaScript for finding tokens of a simple domain-specific language. I started with a simple implementation which just tries to match subsequent regexps from the current position in a line to find out whether it matches some token format and accept it then. The problem is that when something doesn't match inside such regexp, the whole regexp fails, so I don't know which character exactly caused it to fail. Is there any way to find out the position in the string

PHP Lexer and Parser Generator? [closed]

你离开我真会死。 提交于 2019-11-28 06:33:51
I know question Lex and Yacc in PHP was asked before but 1 year ago. Is there any new mature PHP parser generator now? My searches drove me to the following ones, what do you think about them, any others? code.google.com/p/antlrphpruntime/ : The ANTLR PHP version but it seems to be very beta version and I think there is a lot of work to do. The advantage is that I can write the grammar in the ANTLR Works tool. pear.php.net/package/PHP_ParserGenerator/docs/0.1.7/ : I tried but it seems very complicated, to be used with the PHP_LexerGenerator. sourceforge.net/projects/lime-php/ : I didn't try

PHP Lexer and Parser Generator? [closed]

跟風遠走 提交于 2019-11-27 01:23:50
问题 I know question Lex and Yacc in PHP was asked before but 1 year ago. Is there any new mature PHP parser generator now? My searches drove me to the following ones, what do you think about them, any others? code.google.com/p/antlrphpruntime/ : The ANTLR PHP version but it seems to be very beta version and I think there is a lot of work to do. The advantage is that I can write the grammar in the ANTLR Works tool. pear.php.net/package/PHP_ParserGenerator/docs/0.1.7/ : I tried but it seems very