Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Experiment - Better string literals?

 
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language
View previous topic :: View next topic  
Author Message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Aug 11th, 2014, 4:44pm    Post subject: Experiment - Better string literals? Reply with quote

I was recently looking to improve the "stringError" token in VF's lexer to account for more of the many forms of "stringLiteral" when it occurred to me that the recently introduced metastring token (eg, $CR) could potentially replace a portion of the functionality of "stringLiteral" and improve readability at the same time. If anyone agrees, I'll upload a new VF.exe that implements this feature.

The old version of "Hello World" looked like
Code:
Require IO #out
#out "Hello, world!"NL""

The new version looks like
Code:
Require IO #out
#out "Hello, world!" $NL
End

Any number of metastrings can be abutted, without an explicit concatenation operator, to form a complete string literal. Quoted literals and metastrings can likewise be abutted together, but multiple quoted literals cannot without prepending an underscore to the noninitial literal(s).

You may also notice that the second code above has an END statement whereas the first does not. The most recent release of VF.exe now requires an END statement mainly as a way to suppress the warnings produced by the parser generator I use. If you have an opinion on this, I am all ears.

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
STPendl
Full Member


Joined: 20 Aug 2007
Posts: 161
Location: Austria

PostPosted: Aug 12th, 2014, 7:25pm    Post subject: Re: Experiment - Better string literals? Reply with quote

The new syntax is easier to remember and doesn't look so strange.
_________________
Stefan

Any code I post can be freely used, just give credit.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Bay Six Software Forum Index -> ViviFire language All times are GMT
Page 1 of 1
Jump to:  
Quick Reply
Username:
Message:
   Shortcut keys: Alt+Q to activate, Alt+P to preview, Alt+S to submit
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group