Software necromancy with Perl Dave Lambley dlambley@cpan.org
Accounting software
Informix C-ISAM
1987 ● Perl 1.0 ● GCC 1.0
TPS report example
Historic 4GL ● Variables bound to database fields. ● Schema defined outside code using UI. ● Weakish types.
Implied dualvars, predating Perl’s?
Regexp::Grammars ● Perl 5.10 recursive regexps. ● Build a parser from familiar regexps. ● No separate lexical analysis. ● Mis-parses are slow and hard to debug
a s s i g n m e n t c o n s t a n t l v a l u e c o n s t a n t = 0 i d e n t i fj e r = t p s _ r e p o r t _ i d
a s s i g n m e n t c o n s t a n t l v a l u e c o n s t a n t = 0 i d e n t i fj e r = t p s _ r e p o r t _ i d
Regexp::Grammars
s
S e t a c c u m u l a t o r o n t p s _ s t a t u s C o m p a r i s o n I d e n t i fj e r = t p s _ s t a t u s e q 1 S e t a c c u m u l a t o r C o n s t a n t = 1 F o l l o w i n g l i n e s e t t p s _ n u m A d d t o a c c u m u l a t o r I d e n t i fj e r = t p s _ n u m + 1 Mu l t i p l y a c c u m u l a t o r C o n s t a n t = 1 * 3 S t o r e i n v a r i a b l e C o n s t a n t = 3 = t p s _ n u m S e t a c c u m u l a t o r I d e n t i fj e r = t p s _ n u m s e t t p s _ c h e c k o u t A d d t o a c c u m u l a t o r I d e n t i fj e r = t p s _ c h e c k o u t + 1 S t o r e i n v a r i a b l e C o n s t a n t = 1 = t p s _ c h e c k e d I d e n t i fj e r = t p s _ c h e c k e d
Phases ● Preprocess text (join line continuations, remove comments. ● Parse lines to parse tree. ● Flatten parse tree to op list. ● Execute op list.
In summary ● Laziness as a virtue predates Perl 1.0.
But next ● Is Perl dead? ● Is the Perl demoscene dead?
Presenting demo#1 ● Code by DLAMBLEY of CPAN. ● Grafix by .. no-one. ● Music by no-one.
Demos and games need hardware Sources: CSG and Acorn Computer
Source: https://www.khronos.org/opengl/wiki/Rendering_Pipeline_Overview
OpenGL ● SDL.pm recommends OpenGL.pm. ● OpenGL.pm gives you most of OpenGL 1.2.
Source: https://www.khronos.org/opengl/wiki/Rendering_Pipeline_Overview
A vertex shader
A fragment shader
s
Pascal? ● ObjectWindows ++ ● Pointer arithmetic ++ ● Compiler ++ ● IDE ++ ● System library --
FreePascal ● Author terrified of leaving DOS. ● https://www.freepascal.org/ ● fpc -Mtp foo.pas ● fpc -Mtp -Ci -Co -CR -Cr -Ct -g foo.pas
Artistic license? DFSG??
A new GRAPHWIN.PAS ● “graphwin.pas”
Running it
Does it work?
Grab the code! It works! ● https://github.com/davel/perldemo ● https://github.com/davel/pascal-games ● My customer needs more Perl, talk to me.
Recommend
More recommend