I was able to fix the 'and' 'or' 'not' issue by turning their
definitions into functions, instead of just strings, not sure why that
fixed it :/

On Oct 7, 7:54 pm, Alex_Gaynor <[EMAIL PROTECTED]> wrote:
> I was able to succesfully implement True and False by making them
> tokens(I do want them to be reserved ala py3k), so thanks for the help
> with that!  I am also looking over the things on indentation, although
> I suspect that will be something that goes in later.  Right now I am
> having some issue implementing 'and' 'or' and 'not'.  Right now I have
> them implemented the same way I do other unary and binary operators
> which I suspect isn't working.  Right now whenever I try True or
> False, or not True, or True and False I get a syntax error, and I'm
> not sure what causes this.  All my code is 
> here:http://github.com/alex/alex-s-language/tree/master
>
> On Oct 7, 6:59 pm, Bruce Frederiksen <[EMAIL PROTECTED]> wrote:
>
> > If you make True/False tokens, that generally means that they are
> > reserved words in your language.  That means that nobody can use them
> > for other purposes.
>
> > If you want to let people use the words "True" and "False" for other
> > purposes, then you probably don't want them to be tokens.  In this case,
> > you will probably end up doing a lookup at runtime, which might find
> > some other value.
>
> > In python 2.5, for example, you can use True and False for other purposes:
>
> > def False(): print "hi mom!"
>
> > is OK.  But this becomes illegal in python 3.0.
>
> > I've attached a scanner the does indenting ala python (i.e., the
> > programmer can indent any amount so long as they line up).
>
> > -bruce
>
> > Alex_Gaynor wrote:
> > > I'm looking to implement a boolean type in my language, where exactly
> > > should I do this?  Should I make True and False both be tokens, and
> > > just set t.value = True/False.  Or should the parser handle them?
>
> > > Also, how would I go about implementing a language that uses indent/
> > > dedent for blocks(ala python)?
>
> > > Alex
>
> >  scanner.py
> > 19KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to