lexical-analysis Questions

1

Solved

The Haskell Report includes a somewhat notorious clause in the layout rules called "parse-error(t)". The purpose of this rule is to avoid forcing the programmer to write braces in single-line let e...
Lp asked 2/9, 2015 at 4:25

2

Problem I have a legacy codebase I need to analyze and determine dependencies. Particularly the dependencies on classes (internal/external) and extensions (Memcache, PDO, etc). What I've Tried I...
Fayre asked 26/10, 2012 at 14:17

1

The import statement or the tokenVocab option can be put in a parser grammar to reuse a lexer grammar. Sam Harwell advises to always use tokenVocab rather than import [1]. Is there any difference...
Prevision asked 3/3, 2015 at 10:10

4

Solved

I am attempting to write an interpreted programming language which will read in files and output a bytecode-like format which can then be executed by a virtual machine. My original plan was: Beg...
Roughspoken asked 1/4, 2015 at 16:23

2

Solved

I have written a very simple file with specification shown below to to tokenize words: %% %class Lexer %unicode WORD = [^\r\n\t ] %% {WORD} {System.out.println("Word is:"+yytext());} . {System....
Window asked 2/4, 2013 at 20:8

4

Solved

I am new to CFG's, Can someone give me tips in creating CFG that generates some language For example L = {am bn | m >= n} What I got is: So -> a | aSo | aS1 | e S1 -> b | bS1 | e bu...

2

Solved

I’m trying to parse C++ code. Therefore, I need a context-sensitive lexer. In C++, >> is either one or two tokens (>> or > >), depending on the context. To make it even more compl...
Aldwin asked 9/12, 2012 at 14:29

2

I am trying to create a lexical analyzer for a compiler.But I have a problem using regular expressions to find things like keywords and real numbers.. for example some definitions : id [aA-zZ][aA-...

3

Solved

>>> 1 .__hash__() 1 >>> 1.__hash__() File "<stdin>", line 1 1.__hash__() ^ SyntaxError: invalid syntax It has been covered here before that the second example doesn't w...
Coping asked 8/10, 2014 at 11:23

3

Solved

Consider the following lines: int i; printf("%d",i); Will the lexical analyzer go into the string to parse % and d as separate tokens, or will it parse "%d" as one token?
Alienation asked 30/8, 2014 at 12:47

1

I'm learning to use Alex and Happy to write a small compiler. I want to maintain line and column information for my AST nodes so that I can provide meaningful error messages to the user. To illustr...
Decompound asked 15/12, 2013 at 1:39

1

I'm interested in learning how to write a lexer generator like flex. I've been reading "Compilers: Principles, Techniques, and Tools" (the "dragon book"), and I have a basic idea of how flex works....

4

Solved

I'm currently implementing a lexer for a simple programming language. So far, I can tokenize identifiers, assignment symbols, and integer literals correctly; in general, whitespace is insignificant...
Benedikta asked 13/5, 2014 at 0:47

4

Solved

I have a lexer built that streams out tokens from in input but I'm not sure how to build the next step in the process - the parse tree. Does anybody have any good resources or examples on how...
Peen asked 19/1, 2009 at 4:47

3

Solved

Are there any good code profilers/analyzers for Erlang? I need something that can build a call graph (eg gprof) for my code.
Culminate asked 15/10, 2008 at 14:28

7

Solved

I am trying to make a calculator in C or Objective-C that accepts a string along the lines of 8/2+4(3*9)^2 and returns the answer 2920. I would prefer not to use a generator like Lex or Yacc, so...
Nanosecond asked 2/5, 2011 at 3:1

1

Solved

I want to be able autocomplete names. For example, if we have the name John Smith, I want to be able to search for Jo and Sm and John Sm to get the document back. In addition, I do not want jo sm...
Apprehensible asked 10/6, 2013 at 5:11

4

Solved

I am making a basic lexical analyser in Java for my semester project and I am at conflict on a concept with my subject teacher. My view is that in general if an input like "1a" is given to lexica...
Fancyfree asked 29/5, 2013 at 16:52

3

Solved

I want code that can analyze a function call like this: whatever(foo, baz(), 'puppet', 24+2, meow=3, *meowargs, **meowargs) And return the positions of each and every argument, in this case foo,...
Serai asked 19/5, 2013 at 13:38

1

Solved

I need to map jsoup elements back to specific character offsets in the source HTML. In other words, if I have HTML that looks like this: Hello <br/> World I need to know that "Hello " star...
Finsen asked 8/7, 2012 at 23:9

6

Solved

Lexical analyzers are quite easy to write when you have regexes. Today I wanted to write a simple general analyzer in Python, and came up with: import re import sys class Token(object): """ A si...
Bryonbryony asked 25/9, 2008 at 15:10

1

Solved

I'm working on a small Haskell project that needs to be able to lex a very small subset of strictly formed English in to tokens for semantic parsing. It's a very naïve natural language interface to...
Strength asked 7/2, 2013 at 21:1

1

Solved

(I'm just learning how to write a compiler, so please correct me if I make any incorrect claims) Why would anyone still implement DFAs in code (goto statements, table-driven implementations) when ...
Eschar asked 19/1, 2013 at 22:34

4

I'm the "programmer" of a team of pupils that aims to investigate satisfaction and general problems in my grammar school. We have a questionary that is built upon a scale from 1-6 and we interpret ...

2

Solved

I was coding and accidentally left out a space between a constant reference and its default value. I was surprised to see that it came up as an error in Intellisense, so I compiled it, and sure eno...
Vigilance asked 29/11, 2012 at 20:55

© 2022 - 2024 — McMap. All rights reserved.