All Questions
41 questions
0
votes
1
answer
92
views
Concatenating strings given a BNF grammar
<Definition> ::= <Name> <LeftPar> <param> <RightPar>
<Name> ::= <Letter><LetterTail>
<LetterTail> ::= <Letter><LetterTail> | ‘’
A ...
0
votes
1
answer
172
views
What lessons can be learned from the architecture/combination of ESLint and Prettier for linting and code formatting?
I was looking through the prettier docs and the prettier source code. It essentially has those defined helper functions to layout the text, given an AST. It operates on the level of the whole file, on ...
-1
votes
2
answers
211
views
When writing a tokenizer, what is the standard practice for handling aliased language keywords?
When writing a tokenizer, what is the standard practice for handling aliased language keywords?
For example, notethat signed short int is a language keyword in C++ and several aliases might be allowed....
-1
votes
1
answer
235
views
Better way to represent grammar symbols in C
I'm trying to build a simple compiler for a subset of the C language in C. To achieve this, I needed to figure out a way to represent the grammar symbols. Basically, each symbol can either be a "...
0
votes
1
answer
194
views
Parsing complex data type names
How do compilers parse complex data types names like function pointers. The type has to be somehow put into the AST or it has to be processed during parsing. What are the pros and cons of different ...
0
votes
3
answers
961
views
Is it possible to make a compiler for any dynamic/script/interpreter language
Logically, not based on how cost we will spend or how much we will hire programmers to do it.
Can we (Is it possible to) make a compiler for any dynamic/script/interpreter language, like Lua, Python, ...
0
votes
1
answer
394
views
Benefits of using a tokenizer/lexer before parsing for recusive descent parser
I am trying to build a static program analyzer for a proprietary progamming language for a school project, and am currently trying to implement the parser from scratch.
I was wondering, what are the ...
1
vote
0
answers
110
views
Is there a easy and useful error handling algorithm for bottom-up based parser?
My English skill is poor because I'm not a native English speaker.
Please understand.
I wonder that there is a error handling algorithm easy and useful in LR parser.
LR Parser is bottom up based so it ...
8
votes
3
answers
5k
views
What are the 'practical' advantages of LR parser over LL parser 'in today'?
My English skill is poor because I'm not a native English speaker.
Please understand.
I write this article because want to discuss about this topic.
I think LR parser has no 'practical' advantages ...
0
votes
1
answer
315
views
Are parser generators useful for parsing a shell language?
From my understanding, parser generators accept as input some form of context-free grammar description. The context-sensitive features are handled during semantic rather than syntactic analysis (...
2
votes
3
answers
690
views
Is a literal out of range a syntax error or a semantic error?
I am reading more about the differences between syntax and semantics, but I am still wondering about this one.
Let's assume that we have a language that only allows integers to be in the range of 0-...
7
votes
2
answers
2k
views
How can one interpret an Abstract Syntax Tree without recursion?
I am busy building an interpreter for a Rebol-like language. I have previously built a Lisp interpreter where I used recursion, but now I just want to use a stack and not rely on the recursion ...
1
vote
4
answers
3k
views
Should my lexer allow what is obviously a syntax error?
This is kinda like a concrete version of the question Coming up with tokens for a lexer.
I'm writing a lexer for a small subset of HTML. I'm wondering what should I do when the input stream ends and ...
-5
votes
1
answer
840
views
LL(K) grammer generation for postfix expressions [closed]
I have a problem in formulating LL(K) grammar for this postfix expression problem, given (4 3 / 2 * 4 5 / +) as an input must output 52/12
0
votes
2
answers
4k
views
Understanding Context Free Grammar using a simple C code
I'm trying to understand the difference between terminal and non-terminal values in a real language. I wasn't able to find enough examples on real language CFGs on the internet, most examples are ...