Questions tagged [lexical]

The "Lexical" tag is used to denote a connection with words of a language, its grammar or the dictionary. Alternatively, it is also used in the context of "lexical scope," the context in which certain values are valid.

Broadly, Lexical is used to refer to words of a language. (The terms in applicable to natural (human) languages, as well as to computer programming languages. Lexical is derived from "Lexicon" and therefore the tag is also applied to questions relating to the dictionary for a language.

Finally, the tag is used in a computer programming context: Lexical Scoping. A lexical scope is the "context" within with certain rules/values apply (Example the "scope" of a local variable.)

204 questions
3
votes
1 answer

Lexical analyser with C, new line token

I have 4 rules rule1: match variable rule2: match Float rule3: match Integer rule4: [ \t] ; //skipping space, tabs rule5: \n ; now I want to have a rule for matching error, anything else that is not ID,Float,Integer, eg:"&^()>~...." So this is…
blueyan
  • 33
  • 3
3
votes
2 answers

Need help understanding (lexical) variable scope in Javascript

I have a .js file that I am executing with NodeJS. Here are the contents of my file: var ctry = "America"; function outer(msg) { console.log(msg + " " + ctry) ; var ctry = "Canada" ; } outer("God Bless"); When I run this file, I expect to…
bachposer
  • 953
  • 3
  • 8
  • 17
2
votes
0 answers

Adding positioned to Lexical/StdLexical in Scala

I'm creating a Lexer in the vein of StdLexical with a few changes in terms of behavior (but for the purposes of my question, a demonstration of how to add it to StdLexical would be fine). I'm trying to add support for recording the positions of…
2
votes
0 answers

Lexical Errors:misspelling of keywords

In the dragon book it is mentioned that "Lexical errors include misspelling of identifiers,keywords,or operators" I am a bit confused how will a lexical analyzer find a misspelling of keyword wont it consider the misspelled keyword as an…
Rachel
  • 305
  • 2
  • 12
2
votes
0 answers

Lexical Editor with react to detect word postion

I'm trying to use Lexical editor with react to implement a text editor "similar to the Grammarly concept" to send each typed word with its index on socket. I need to know what is the best way to implement it considering if user change specific word…
Noor Shaker
  • 37
  • 1
  • 6
2
votes
1 answer

lexically scoped variable retains value after being overwritten in a getJSON call

In the code at the end of this post, the variable pPrice is defined via $(addProduct).attr(attrProductPrice); and then set in a JSON call via $.getJSON(url, function(data) { console.log(data); pPrice = data.price; }); but after the synchronous…
Terrence Brannon
  • 4,760
  • 7
  • 42
  • 61
2
votes
4 answers

Is it possible to prevent new paragraph node with enter in editor?

I´m trying to create a "one line" message component based on Lexical, but i´m unable to prevent the enter key to create a new paragraph. Any ideas how to accomplish this? I´ve added styling with white-space: nowrap!important; resize:…
2
votes
1 answer

Send Lexical data to a server and read it with a new lexical component

this is my first time asking a question with stackoverflow, but I'm stuck on this problem for too many days. My question, how can I change the initialConfig.editorState to the stringifiedEditorState that I just save in my database? So far, I'm using…
2
votes
0 answers

2147483648 and 2147483647, which is the biggest value of integer?

When I read the Java 13 spec, I saw 2 things as follows: The largest decimal literal of type int is 2147483648 (2^31). The largest positive hexadecimal, octal, and binary literals of type int - each of which represents the decimal value…
locobe
  • 69
  • 7
2
votes
1 answer

F# recursive function that takes single point and index

How do you write a F# recursive function 'something' that takes a single point (x, y) and index i as an arguments and returns an ℎ element of the infinite list corresponding to S(x, y). ex: let something (x,y) i = F# function F(,) should be defined…
CTNgel
  • 75
  • 4
2
votes
2 answers

How are apostrophes/character literals parsed in Haskell?

I'm trying to write something that reads Lambda expressions and outputs a beta reduced version. Lambdas will be typed as follows : \variable -> expression and applications will be of the form (expression) (expression). So if '\' is found at the…
Eben Kadile
  • 759
  • 4
  • 21
2
votes
1 answer

Lexical analysis using lex

Before I will show what I have done here is the assignment I have tried to do(I'm new so im not really sure if im doing it allright). 1. Implement lexical analyzer (using FLEX), as follows: - Lexical analyzer supplies services next_token(),…
user2323232
  • 249
  • 2
  • 11
2
votes
1 answer

Scope in Scheme (Lisp)

I know that scheme is a lexically scoped/statically scoped language, but I don't understand why these two blocks of code return different results. (define a 100) (let ((z 20)) (lambda (a b) (+ a b)) a z) 20 (define a 100) (let ((z…
Clayton
  • 43
  • 4
2
votes
1 answer

C++ lexical analyzer

I'm trying to write a small lexical analyzer and I have a small question Consider the following string cout << "hello world ; Note that it doesn't have the " at the end. Should I consider everything after the initial " a string and say there is a…
Shury
  • 468
  • 3
  • 15
  • 49
2
votes
0 answers

Lex code to divide C program into Functions and signatures

I was trying to create a Lex program that does the following: INPUT float hey1(int a, int b); OUTPUT Function: hey1 it returns: float Signature: a - float b - float With the current knowledge I have of LEX, I decided to input the test file and…