If I define two regular-expression rules such as: "if" { return TT_IF; } [a-zA-Z]([a-zA-Z]|[0-9] { return TT_IDENTIFIER; } Then in my code I have something...
... Assuming this is a general question and not specific to yacc/lex ... there are two ways of combining lexers and parsers. The yacc/lex model is that you...
... The Edinburgh Computer History Project has quite a few versions of the same basic parser as it was developed over the years, but this is about the earliest...
... Yep :-) By the way, found this today: http://easynews.dl.sourceforge.net/sourceforge/inger/CompilerConstruction.pdf 246 page book on writing a compiler for...
I actually ran across a PDF on oolex yesterday and found that their approach made sense to me. What it described was the concept that each lexer rule is in a...
Someone also mentioned that FLex/Lex returns against the rule with the longest match. Assuming you have "IF " as your input and two rules, one for 'IF' and...
... I dunno, why don't you try it out! Here's an oldie from the 60's: in FORTRAN you can have a for loop DO 10 I = 1, 10 and a simple assignment DO10I = 1.10 ...
Essentially, Flex/Lex/JFlex apply two basic rules: 1. The longest match rule 2. When there's a tie, the first rule on the list is applied. The example of the...
Can someone explain how to maintain alignment within my stack machine? I was considering the notion of using a block of memory as my stack machine. The code...
... machine? ... stack machine. The code would be loaded into the bottom lower address portion of the memory block and the stack would grow from the higher...
... stack prior-to, during the call-to, and how to cleanup after calling a function and how to deal with the activation records on the stack? I forgot your...
Hello, I had written an interpreter approx 11 years back as part of my academic course project. It was not done the lex-yacc way, it was hard coded in c...
Hi Guys... I m in immediate need of the solution for writing a syntax analyser using lex and yacc....here the language i m using is C on Linux... (Red Hat...
Hi, Can any one please tell me what type of parser is used in most of the modern c/c++ compilers? I am actually interested in knowing as to what is the look...
I hope everyone had a good new year. I have been very busy over the last few months with travel and just had a moment to revisit my compiler project I was...
... Take a look at Wirth's Pascal-S for one approach: www.moorecad.com/standardpascal/pascals.html has a good discussion of Pascal-S, and the original paper...
... Thanks, I'll take a look. I also found that COCO/R (I don't know how I missed this) does, as well as one called wacco: www.codegen.com/freesoft/wacco.tgz ...
What I originally thought is I'd need to define my stack as something like: unsigned char stack[32768]; // 32k stack. Can someone comment on this concept and...
CRANFORD, CHRIS
Chris.Cranford@...
Jan 26, 2006 2:27 pm
596
... Do you need to fetch objects off in larger chunks than a byte at a time? I.e. is an integer fetch something like I = stack[SP] << 24 | stack[SP+1] << 16 |...
Yes, I will need to be able to put 32-bit addresses, integers, longs, floats, etc on the stack. Can you provide me an example of how to push these types of...
CRANFORD, CHRIS
Chris.Cranford@...
Jan 26, 2006 5:09 pm
598
... off the top of my head, not run through a compiler... // method 1: ignore alignment, do everything a byte at a time #define push(x) push(&x, sizeof(x)) ...
When you say that it does not work well with binary code, are you refering to an actual executable binary file or just storing the data in an intermediate file...
CRANFORD, CHRIS
Chris.Cranford@...
Jan 26, 2006 7:08 pm
600
... Executable. When fully compiled a single store into the stack should be a single instruction, not four plus overhead. When compiling, you generally know...
Graham, Again, thanks for all your help. I know we may have spoke about this in the past, but what about floats/doubles? These are 8-bytes. I extended your...
CRANFORD, CHRIS
Chris.Cranford@...
Jan 27, 2006 1:16 am
602
Hi there, I am new to this group, and I hope someone could help me, sorting out my question? I have had a look at Fabrice Bellard's otcc(n) Compiler. I am very...
... I'm not sure there is any special name for it, or any special technique. Basically his compiler is a straight-forward 1960's style 'student system'...