i've been watching a video on how compilers break down code and converts them into tokens , i came across this part which kind of means that the lexer actually figures out lexemes , which are closer to the words of a sentence and tokens are kind of like verbs . can anybody just explain the heirarchy and what sits where,
if token is like a verb are there types of tokens and lexemes are just examples of these token types, like run is an example of a verb
the video
what is a token , what is a lexeme
357 Views Asked by bufor At
1
There are 1 best solutions below
Related Questions in COMPILER-CONSTRUCTION
- Reference: Crafting Interpreters. Print statement is not able to evaluate expression. Help me fix this (details below)
- Load function written in amd64 assembly into memory and call it
- I have implemented till Statements and State in Tree Walk Interpreter. I am pissed with an error
- Resolve shift/reduction conflict in grammar for expressions in PLY for calls to embedded functions
- Grammar for access to properties and calls to embedded functions
- LLVM code generation causes problems with pointer arithmetic
- what does react compiler mean actually?
- Errors on Recursive Descent Parsing Java
- Java CUP produces Shift-Reduce conflict when parsing a grammar for a C++ type language
- Three-Address-Code (TAC) and Conjunction/Disjunction
- How do I write an implicit cast for my strongly typed interpreter? (C++)
- Yacc parser not reducing specific production rules as intended
- Why is the function version tag consistently "Base" in HDF5 library?
- Sly parser, how are recursively defined types implemented?
- Does a non terminal token need an explicit definition?
Related Questions in TOKEN
- Authenticate Flask rest API
- How to solve Config validation error when tokenizer is not callable in Python?
- RequestClientCredentialsTokenAsync and ClientAssertion Encoded
- read contents from a file on git using ansible
- issue of retrieving fcm token?
- How to change the token expiry time after page refresh in angular?
- Persist Offline Tokens in separate database
- How Do I Solve This BSCScan Verification Error?
- How to secure JWT token
- GET http://localhost:5000/api/user/allusers?search=s 401 (Unauthorized)
- I am having a problem while creating a token in NodeJS. Is there any solution please?
- How to get access token correctly from SAP Successfactors api?
- Verify Token To Login In Firebase (Aauthorization)
- Inherit session token between 2 apps as long as one of them has been signed in Ember.js
- Unable to mint SPL 2022 token but able to create it using metaplex
Related Questions in GRAMMAR
- Need clarification on pumping lemma for context free languages
- Grammar for combinations of Numpy arrays
- What is exactly Ruby's `not` keyword?
- VSCode Extension - Grammar Injection Into Multiple Languages
- Integrating Grammar/Spellcheck Tool in ASP.NET Application for Textarea
- Is the alternative operator in ABNF match first or longest?
- ANTLR4 matches to lexer rule instead of parser rule
- Distinguishing integer and decimal arithmetic with ohm.js
- Trouble with Island Grammar parsing unordered network configuration using Python textx
- ANTLR4 for Function Pointers in C
- Constructing grammar based on given rules
- Is this grammar LR(0) or SLR(1)
- ANTLR4 explain variable declaration error
- Bison ID reduction conflict
- SGF Grammar Parser with Peggy
Related Questions in FORMAL-LANGUAGES
- Understanding Unary PCP Reduction to a Matching Problem (UPCP)
- Balanced parentheses and brackets, where a closing bracket also closes any outstanding open parentheses (up to the previous open bracket)
- How can I generate a Context Free Grammar for a specific language
- Definition of "operator", and by extension "operand", in Python terminology
- Is ambiguous cfg(context free grammar) more expressive than unambiguous cfg?
- how to solve the undetermined issue in a let-such-that expression in Dafny?
- Finding a regular grammar for the language L
- Training difficulties on Transformer seq2seq task using pytorch
- Recognize the type of the given formal language
- VECTORSZ size is too small in ispin
- Talend application scenarios: is it correct to have logical operators in the first term of GAV mapping?
- Grammars, parsers and infinite loops
- How to construct DFA that L accept : w contain '110' and doesn't contain '010'?
- Swift String (With Diacritics) Isn't Passing Into CLI Process Correctly
- type variable in datatype definition
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Here we have our input:
Let's get the lexemes as a list now:
Please remember that these are lexemes, meaningless strings of characters.
"The", although in English, has a meaning, in our example, it currently conveys no meaning or information. It is simply "T", then "h", followed by "e". Nothing else.The next step is to look at these lexemes and give each of them a meaning, creating tokens. Often, the meaning changes depending on the given context.
So for
"quick", we could say it is:Notice that we have now associated a meaning to this lexeme, its type, which is an adjective. Here is what a
"fox"could be:However, tokens are not useful by themselves. We need a meaningful structure from the list of tokens. That's what the next step is usually for: parsing.
In our example, a parser might turn our input into the following:
Now we've got a useful data structure from a 1 dimensional input! Fascinating! It's important to note that tokens can contain more information than just a type and the lexeme. They could, for example, also contain the line and column the lexeme was found.
You also may not realize it, but this is how you read! You are always reading in the list of lexemes, giving them meanings, then creating a structure from that and interpreting what the meaning of the entire sentence was.