I'm going to try and make a slightly more comprehensive test file but for now this is showing an error in the assignment.
Would it be possible to get the parser to output the comments to make it easier to see where in the source we are?
I get this error when I try and upload a spin file. Anyone know a way around it other than renaming the file?
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
My bleary morning eyes was reading this as the error you were getting in the parser itself. I'm thinking "what kind of crazy stuff is the Mac doing?! I never put any XML in there!". I completely didn't expect to see a forum bug report here. Nobody expects the Spanish Inquisition!
Thank goodness Jasper_M was in the IRC channel to set me straight
I'll look at this one later today.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
Okay, here is a test file. I will keep adding things to it as I get time. I will only put in things that compile with the current compiler. At some stage I will try to make another file with
all the syntax errors I can think of.
Once you get the parser working with multiple files I'll split it up into separate objects so it is easier to find stuff.
I think that the parser has an error when parsing the method name rows. The '|' that signifies the start of local variables is coming out as an OR statement.
I've gotten myself buried in too much stuff, really and I just moved to a new apartment. Sorry, it's going to be slow for a while. I'm thinking it will be back on my radar sometime in May.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
Absolutely! Dfletch is the man here, but if you have some spare cycles to help, try downloading and
building the project from sourceforge and see what works and what doesn't. Then chat with dfletch
(and me if you want) about what remains and how it should be done.
There are a lot of separable pieces, all of which are pretty approachable. I believe right now dfletch
is making the parser multipass so it can pick up declarations properly before needing the uses. We
also need someone to add a treewalker to generate the actual binary code; that will take some study
of what people have done and perhaps some reverse engineering.
But always, the first step is to download and build. I posted some instructions earlier.
I pulled down a copy of spinparser-0.0.0rCVS a while bace and it makes fine on my MacBook Pro. But where are the instructions you posted? Do I need to setup CVS? -Chuck-
cvs -dserver:anonymous@spinc.cvs.sourceforge.net:/cvsroot/spinc login
cvs -z3 -dserver:anonymous@spinc.cvs.sourceforge.net:/cvsroot/spinc co -P spinparser
This does an anonymous checkout. This *should* work on either Unix or on Windows with cygwin
(and one would hope on the Mac too).
If you want to contribute back to the codebase, you'll need to register on sourceforge (it's quick
and easy) and then let me or dfletch know you want checkin privileges.
cvs login: CVSROOT password specification is only valid for
cvs login: pserver connection method.
cvs [noparse][[/noparse]login aborted]: Bad CVSROOT: `server:anonymous@spinc.cvs.sourceforge.net:/cvsroot/spinc'.
cvs -d[img]http://forums.parallax.com/images/smilies/tongue.gif[/img]server:anonymous@spinc.cvs.sourceforge.net:/cvsroot/spinc login
cvs -z3 -d[img]http://forums.parallax.com/images/smilies/tongue.gif[/img]server:anonymous@spinc.cvs.sourceforge.net:/cvsroot/spinc co -P spinparser
Looks like something ate the maybe thinking they were smilies.
Ugg, did it again. How do I get it to work without the smilies? This is code!
In any case, the -d argument should look like
- d : p s e r v e r ...
but without the spaces of course. If someone knows how to make this forum work
correctly, maybe they can tell me how to include code without getting it munged.
I had it working on mac os 10.5 without any dramas. Unfortunately I don't know enough about compilers (or have the time to learn) to do anything useful except break it. I started putting a test suite together awhile ago but never finished it.
@rokicki, try phil's code page here www.phipi.com/format. It should make those problems disappear. It just changes things that will muck up the forum into ascii or something.
Thanks. I have an old version running, but the version in CVS (that I checked out yesterday) is the one getting the build error. The older one builds fine.
Hi. Actually I started working on this again last week.
Got tripped up on something (I forget exactly what ATM) last weekend and took a small break.
Will be working more on it this weekend, hopefully a big new rev coming shortly.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
So I'm implementing multiple passes. So when a function name or var or dat variable etc. is defined lower down in the file,
the parser can still recognize it for what it is.
To do this, we'll have a "name pass" where it only picks up the name and type of certain items. Then on a subsequent
"code pass", those names are recognized and parser rules can expect a type of element explicitly.
This keeps the parser nice and clean - we don't have to detect for example that someone put a CON variable in a postfix
expression because the parser would simply not allow it - there's no rule that says it can happen.
Now, that's all good in theory except I totally botched it in my first attempt. What I tried to do was make the lexer limit what
tokens are sent into the parser depending on which pass we're doing. I don't know what I was thinking but it's completely
backwards. The lexer should pass all tokens on every pass, and the parser should switch what action it takes depending
on the current pass.
So I'm chucking away a bunch of bad code and starting this rev pretty much from scratch. Well sorta - two changes I can
keep. One is the ability to use a FILE pointer instead of stdin. The parser and lexer are both re-entrant now as well
(meaning it's possible to recurse into it for OBJ support) and I can keep those changes too.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
OK! Multi pass parsing is starting to work. On the first pass, I'm getting CNAMEs from the lexer.
On the second pass, these come out as the appropriate token type like CONSTNAME etc. Only
prob now is the grammar doesn't actually have rules to handle all these new types!
I'm doing an interm commit now and will have a better working version tomorrow or so.
On another front, Jasper_M volunteered in IRC to write code to emit Spin bytecodes. So when
we're ready to concentrate on output, hopefully we'll just need to call Jasper's lovely functions
Chuck - I will need some help shortly implementing one other bit, perhaps you could help there.
Constant expressions need to get evaluated. Each expression will be a tree node with an eval()
function. Those eval()s will all need to be implemented, and this is where I can use a ton of help.
I'm not sure how hard it will be to make this consistent on all platforms. Do we just assume that
size of long is 32 bits for example? Is the AdditionExpression::eval() as simple as a+b? See, I'm
already a bit lost
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
Darn! The reentrant option of flex seems to break on MacOSX.
Sorry Mac guys I'll try to figure out a solution. What's weird though is the lexer and parser should not need
to be regenerated unless someone did `make maintainer-clean.`. Weird.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
$ tar xvzf flex-2.5.35.tar.gz
$ cd flex-2.5.35
$ ./configure --prefix=/usr
$ make
$ sudo make install
After this, the reentrant option is recognized and build works normally.
I'll put this info in the README eventually as well..
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
I tried downloading 2.5.35. Configure works. Make fails:
--(2)> make
make all-recursive
Making all in .
if gcc -DHAVE_CONFIG_H -I. -I. -I. -DLOCALEDIR=\"/usr/share/locale\" -I./intl -g -O2 -MT ccl.o -MD -MP -MF ".deps/ccl.Tpo" -c -o ccl.o ccl.c; \
then mv -f ".deps/ccl.Tpo" ".deps/ccl.Po"; else rm -f ".deps/ccl.Tpo"; exit 1; fi
In file included from /usr/include/netinet/in.h:85,
from flexdef.h:79,
from ccl.c:34:
/usr/include/sys/socket.h:97: error: two or more data types in declaration specifiers
make: *** [noparse][[/noparse]ccl.o] Error 1
make: *** [noparse][[/noparse]all-recursive] Error 1
make: *** [noparse][[/noparse]all] Error 2
$ export CXXFLAGS="-Wall -DDEBUG_LEXER -DDEBUG_PARSER
$ make distclean
$ ./configure
$ make
It's quiet unless you define DEBUG_LEXER and DEBUG_PARSER.
Yes syntax error is expected. That's the prob on pass 2 that I described a couple posts ago. Update tonight.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
Yep, that is exactly the expected output currently.
Each "token" is a lexical token coming from spinlex.lpp. Each "type" is a rule that matched in the grammar in spinparse.ypp.
You can see these in the debug rules inside those files.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
Although I am an old programmer, I have never worked on a compiler, so FLEX and LEX and YACC, and BISON, and friends are new to me. I am an old IBM Mainframe Assembler programmer, though I have worked some in C++, and many other languages.
I still have a day job, but I can help at night if you give me the name of the subroutines you need, the input format, and the output desired. And if you can point me to some concise Doc to read, it might help. [noparse]:)[/noparse] -Chuck-
Chuck: I'm hoping to have a set of node objects (like the AdditionExpression I mentioned earlier) that the parser
will create in the next couple of days. Like I said before, the eval() will need to be implemented on these. It won't
need any specific knowledge of how the parser itself works.
I haven't figured out the API exactly yet, but it will possibly look something like this:
pointer<Expression> AdditionExpression::eval(void) {
pointer<Expression> retval = new Expression;
pointer<Expression> a = getChild(0).eval();
pointer<Expression> b = getChild(1).eval();
retval->setIntValue(a->getIntValue() + b->getIntValue());
return retval;
}
When I'm ready for help in a day or two, I'll fill out a couple of the easy ones to help get you started.
This code is totally just an example of what it will be like.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome! Propeller IRC howto spinc - open source Spin compiler
Comments
I'll see if there is anything I can bust.
I'm going to try and make a slightly more comprehensive test file but for now this is showing an error in the assignment.
Would it be possible to get the parser to output the comments to make it easier to see where in the source we are?
I get this error when I try and upload a spin file. Anyone know a way around it other than renaming the file?
Thank goodness Jasper_M was in the IRC channel to set me straight
I'll look at this one later today.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
all the syntax errors I can think of.
Once you get the parser working with multiple files I'll split it up into separate objects so it is easier to find stuff.
I think that the parser has an error when parsing the method name rows. The '|' that signifies the start of local variables is coming out as an OR statement.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
Is there anything that we can do to help get this ball rolling? Maybe define some subroutines that need to be written that some of us can tackle?
building the project from sourceforge and see what works and what doesn't. Then chat with dfletch
(and me if you want) about what remains and how it should be done.
There are a lot of separable pieces, all of which are pretty approachable. I believe right now dfletch
is making the parser multipass so it can pick up declarations properly before needing the uses. We
also need someone to add a treewalker to generate the actual binary code; that will take some study
of what people have done and perhaps some reverse engineering.
But always, the first step is to download and build. I posted some instructions earlier.
This does an anonymous checkout. This *should* work on either Unix or on Windows with cygwin
(and one would hope on the Mac too).
If you want to contribute back to the codebase, you'll need to register on sourceforge (it's quick
and easy) and then let me or dfletch know you want checkin privileges.
Looks like something ate the maybe thinking they were smilies.
Ugg, did it again. How do I get it to work without the smilies? This is code!
In any case, the -d argument should look like
- d : p s e r v e r ...
but without the spaces of course. If someone knows how to make this forum work
correctly, maybe they can tell me how to include code without getting it munged.
I had it working on mac os 10.5 without any dramas. Unfortunately I don't know enough about compilers (or have the time to learn) to do anything useful except break it. I started putting a test suite together awhile ago but never finished it.
@rokicki, try phil's code page here www.phipi.com/format. It should make those problems disappear. It just changes things that will muck up the forum into ascii or something.
Got tripped up on something (I forget exactly what ATM) last weekend and took a small break.
Will be working more on it this weekend, hopefully a big new rev coming shortly.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
So I'm implementing multiple passes. So when a function name or var or dat variable etc. is defined lower down in the file,
the parser can still recognize it for what it is.
To do this, we'll have a "name pass" where it only picks up the name and type of certain items. Then on a subsequent
"code pass", those names are recognized and parser rules can expect a type of element explicitly.
This keeps the parser nice and clean - we don't have to detect for example that someone put a CON variable in a postfix
expression because the parser would simply not allow it - there's no rule that says it can happen.
Now, that's all good in theory except I totally botched it in my first attempt. What I tried to do was make the lexer limit what
tokens are sent into the parser depending on which pass we're doing. I don't know what I was thinking but it's completely
backwards. The lexer should pass all tokens on every pass, and the parser should switch what action it takes depending
on the current pass.
So I'm chucking away a bunch of bad code and starting this rev pretty much from scratch. Well sorta - two changes I can
keep. One is the ability to use a FILE pointer instead of stdin. The parser and lexer are both re-entrant now as well
(meaning it's possible to recurse into it for OBJ support) and I can keep those changes too.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
On the second pass, these come out as the appropriate token type like CONSTNAME etc. Only
prob now is the grammar doesn't actually have rules to handle all these new types!
I'm doing an interm commit now and will have a better working version tomorrow or so.
On another front, Jasper_M volunteered in IRC to write code to emit Spin bytecodes. So when
we're ready to concentrate on output, hopefully we'll just need to call Jasper's lovely functions
Chuck - I will need some help shortly implementing one other bit, perhaps you could help there.
Constant expressions need to get evaluated. Each expression will be a tree node with an eval()
function. Those eval()s will all need to be implemented, and this is where I can use a ton of help.
I'm not sure how hard it will be to make this consistent on all platforms. Do we just assume that
size of long is 32 bits for example? Is the AdditionExpression::eval() as simple as a+b? See, I'm
already a bit lost
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
Sorry Mac guys I'll try to figure out a solution. What's weird though is the lexer and parser should not need
to be regenerated unless someone did `make maintainer-clean.`. Weird.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
You just can't use the flex that comes with OSX, sorry. Fortunately it's really easy to upgrade.
Download latest version: prdownloads.sourceforge.net/flex/flex-2.5.35.tar.gz?download
In a terminal:
After this, the reentrant option is recognized and build works normally.
I'll put this info in the README eventually as well..
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
Post Edited (dfletch) : 6/2/2008 5:31:07 PM GMT
How do I turn on debug?
I tried downloading 2.5.35. Configure works. Make fails:
Flex 2.5.35 configures and makes without errors for me. I have MacOS 10.5.3. On the other hand, I'm having problems with cvs.
It's quiet unless you define DEBUG_LEXER and DEBUG_PARSER.
Yes syntax error is expected. That's the prob on pass 2 that I described a couple posts ago. Update tonight.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
I defined the flags and rebuilt as you instructed. Now I get lots of messages, ending in the CODE pass:
So I guess I am current now.
Each "token" is a lexical token coming from spinlex.lpp. Each "type" is a rule that matched in the grammar in spinparse.ypp.
You can see these in the debug rules inside those files.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler
I still have a day job, but I can help at night if you give me the name of the subroutines you need, the input format, and the output desired. And if you can point me to some concise Doc to read, it might help. [noparse]:)[/noparse] -Chuck-
will create in the next couple of days. Like I said before, the eval() will need to be implemented on these. It won't
need any specific knowledge of how the parser itself works.
I haven't figured out the API exactly yet, but it will possibly look something like this:
When I'm ready for help in a day or two, I'll fill out a couple of the easy ones to help get you started.
This code is totally just an example of what it will be like.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
spinc - open source Spin compiler