[DGD] Scope call syntax

bart at wotf.org bart at wotf.org
Tue Feb 14 01:03:05 CET 2017


I'm playing (among many other things) with a script 'compiler' which generates
a very easy to interpret parse tree for an interpreter I wrote. As it is a
fairly small and simple interpreter, it only knows an equivalent of
(optionally conditional) goto for creating loops. (the input it uses is a list
of nodes, each containing either a reference to another list, a label, or an
instruction with arguments and optional expression for conditional execution)

As I'd also like to generate 'native' lpc code from the 'compiler' output at
some point, having a goto statement seems quite useful, but I've never felt a
need to use it in 'hand written' lpc code.

For now I'm a bit 'sidetracked' by the web ui thing tho, so that lpc code
generation project is not going very fast.

Its an idea I have been playing with in my mind ever since I posted a proof of
concept lpc 2 lpc compiler many years ago.

http://wotf.org/downloads/lpc/happycode.c

Bart.

On Mon, 13 Feb 2017 18:27:38 -0500, quixadhal wrote
> Here’s an example of a thing I couldn’t easily do without goto,
>  in C. 😊
> 
> https://github.com/quixadhal/wileymud/blob/master/src/convert/parse_wiley.c#L564
> 
> Note that this only works because the loop counter variables are 
> outside the loop’s scope, so they can be fiddled with.
> 
> But yes, it’s not normally a thing you really WANT to use, but 
> it’s not as evil as people seem to think.  I think people just got 
> sick of reading BASIC without having it printed on fanfold paper. 😉
> 
> Sent from Mail for Windows 10
> 
> From: Raymond Jennings
> Sent: Monday, February 13, 2017 18:03
> To: All about DGD and Hydra
> Subject: Re: [DGD] Scope call syntax
> 
> I think "goto" became a reserved word or something at some 
> point...but yes, unless you're developing for the linux kernel or 
> otherwise know what you're doing (ducks a tomato), you should avoid 
> goto like the plague IMO.
> 
> Is it used in Hydra?
> 
> *looks at dworkin*
> 
> On Mon, Feb 13, 2017 at 2:42 PM, <bart at wotf.org> wrote:
> 
> > On Mon, 13 Feb 2017 15:13:30 -0600, Blain wrote
> > > I realized after I hit send that I'm segfaulting because I'm within
> > > unlimited stack rlimits. :)  I guess I should load user-made subdomains
> > > after a callout from initd's create().
> >
> > That seems like a good idea. In general, running with unlimited stack or
> > ticks
> > is a bad idea (tm), and will indeed cause a segfault on infinite recursion.
> > Limiting the stack size will prevent that.
> >
> > Its there for if you know what you are doing, but you are on your own when
> > running with unlimited ticks or stack.
> >
> > >
> > > On Mon, Feb 13, 2017 at 3:10 PM, Blain <blain20 at gmail.com> wrote:
> > >
> > > > I have this bad habit of letting up on the SHIFT key while typing "::"
> > and
> > > > doing "mylib:;func()".  A few times, it's actually caused (or seemed to
> > > > cause) a segfault.
> >
> > According to comp/parser.y its an identifier to be used with goto
> > statements.
> > Funny, thats also what I expected it to be from the behavior and syntax,
> > but
> > had to look at the source to confirm because
> >
> > goto??
> >
> > iirc there is no goto statement ;-)
> >
> > Bart.
> > --
> > http://www.flickr.com/photos/mrobjective/
> > http://www.om-d.org/
> >
> > ____________________________________________
> > https://mail.dworkin.nl/mailman/listinfo/dgd
> ____________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
> 
> ____________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd


--
http://www.flickr.com/photos/mrobjective/
http://www.om-d.org/




More information about the DGD mailing list