-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic features for a basic language #5
Comments
thinking control blocks should be using GT and LT < > little fucking boomerangs Start of program tag - CARN While loop - WALKABOUT( NOTBAD ) < Code > variable assignment - SHAZZA x ISA “string”
early exit - FUCKINPIKER |
General thoughts(Note: this is pretty close to just a stream of consiouness; I have certainly played fast and lose with proper syntax defining conventions; sorry about that.) I think the language should be:
I don't think there should be a Print() function as such. Instead, I think that any logical segment of code that evaluates to a literal value should cause the output of that value. Therefore the Hello World program, in full consists of
(If this isn't viable, the print statement might be "Give us") Any output line that does not end with the string "Mate" (prior to punctuation) has a 1 in 20 chance of having the suffix ", Mate" added (before the punctuation). Thus Question: should we use indenting like Python or braces to scope? Literal valuesHere's a crazy idea: what if any parts of the code that are not Note: The hello world program above could therefore have been written without quotes , BUT the keyword MATE would have been ignored:
(though it might at random append ", Mate" anyway...) Tag for start of program
Tag for end of program
(but is this necessary as such? How about End Of File = end of program, but BAIL means exit/return?) assignment
e.g. Variable declaration(something like "let's say x is an int with value 10", but in aussie).
(see below on "and" and "it's") Typesusually dynamicly typed but developer can specify with:
Where type specifier is one of these:
i.e.
means assign the type int to variable x, a.k.a. create varibale x of type int. Esky's are special. esky literals can be implied by [].
populates MyBeers with a list of the specified strings (possibly creating the variable MyBeers if needed)
creates foo to be a list holding type int
creates bar to be a list of untyped variables. I think each one could be potentially of different types... Note that an element of an esky could easily be another esky, making multidimentional array-like structures. BooleansAny of these keywords should evaluate to logical TRUE: YEAH, for sure, fair dinkum, deffo, RIDGY DIDGE Any series of boolean constants in a row with no operations means IGNORE ALL BUT THE LAST ONE: NOT - operator that means NOT. Important to allow NOT WRONG = TRUE Note: AND at the (effective) start of a line has a different meaning to the infix operator AND; see below. Otherwise AND, OR should work as expected. Special keywords and synonyms
eg: "Oh, mate - hey I recon x is 5"
is the same as
Other Special keywordsconstants
special prefix mathematical operations
FunctionsChuck some Dice (random)The pseudo-random number generator keyword is
are equivalent, and return a value between the two numbers, inclusive. If both numbers are integers, an integer will be returned. If one or more of the numbers is a float, any float in the range may be returned.
are equivalent, and return one element from the given esky (i.e. list) at random. (item) is in [Esky]Does the list contain this item? Operations +-*/ (could be symbols, maybe some words like "is this bigger?", but aussie)TODO Branching statements. If, else.YA RECON [statement][is]? (a question - if or case/switch; same thing)
A non-boolean case/switch with multiple matches for one code branch, and an 'otherwise'/'default' (Blow Me Down) clause.
looping (while, for)TODO Early exit ("nevermind" or something).(could be Fuck Off) Exceptions
|
I rate that ^^^ sleep operator should be .winks(40) / Dreamtime(40) |
If regular languages use syntax closer to:
Then this could also be:
|
I love the boomerangs for scoping! |
Also by @howsitcohendevelopment : PIKER for early exit, use of WALKABOUT and TIM/TAM are bonza, mate! 👍 |
Update: I have added a random function called |
Specs part 2Note: I have partially adopted the boomerangs for scope in this, though inconsistently. Nonetheless, here's what I've got: stringsconcatenationString concatenation is achieved simply by juxtaposition. Whatever normally ignored stuff (whitespace, punctuation) is between the symbols is put between the concatenated strings.
(Note: Strings entered without quotes are trimmed of whitespace at each end) If you want to concatenate strings with no spaces or punctuation between them, you need to use the keyword
(A moment to inspect in detail what the hypothetical parser in my head has done here in the line
escaping quotesA Literal quote character is written as !"!.
and if you actually wanted to write !"! it would look like String constantsBugger allThe keyword/constant (note: if used in a comparison with a number, the empty string evaluates as 0, or 0.0) SnagThis is the current system's newline string.
loopingfor loop: Walkaboutintegers
variable begins at startNumber (usually an int but could theoretically be a float.. or anything you an increment/decrement and compare, i.e. int or float so far)
(note: I made one of those outputs have the random ",Mate" suffix, just for fun) {foreach} - traverse an esky (list)
the variable is set to each item in the list in turn. If "backwards" is used, it starts at the end index and works its way back to the start. do/while loop: whack this til the cows come home
after the 6th iteration, the statement If the condition was already true at the start, no iterations would happen. Try/Catch: Av a go (at)/bugger(Implied exception message variable: the fuck up
|
Hahaha ya nong !! Couple of other constants
default case of a switch/case could be known as the BRADBURY case Auto Increment: Up ya tbc |
All good suggestions again @howsitcohendevelopment (though I need a little more convincing on the Bradbury I think) |
Just realised something about the list of keywords to ignore: best to add them to the list of punctuation, I think, which is just mostly ignored, but still appears in string concatenation |
We then could and should also add general English filler words like "the", "a", "also"... and swear words like "fuck(ing)" and, yes, because reddit expects it, "cunt". |
A friend has pointed out that any reference to the word "Fucking" should properly be spelled "Fucken" in Australian. Righty-o, let's make it so. I will also correct the spelling where I wrote "Till" above to "Til" at his suggestion (thanks Daniel) |
Glad to see this project shaping up! Should we begin talking about requirements/specifications like the base language we are going to build this in? |
ive always wrote "fuckin", Yeh its looking like its getting there major thanks to @MarkWhybird, I'd like to suggest we code it in Rust / Go, I've been wanting to get my hands dirty with either.. zero experience mind you.. ive done some C about 6 years ago |
I mostly use C# these days, but I don't mind trying something else... right now I'm just enjoying making up the specs :) |
Yeah, this is looking good! I still have to setup the readme. The classics. Hello World, Fibonacci, a truth-machine... whatever you can think of. I'll make that a separate issue if any of you wants to work on that. And if you want to be collaborators, let me know. the syntax looks fun. It's a little crazy. I'm specially wondering about making keywords consisting of many words, like Maybe we'll have to polish some stuff based on what's possible with our parsing. |
I'm down with using Go. |
I wrote up a whole way of doing both functions and inputs... but I really didn't like it, so I'm starting over. But I have more of an idea what I want to do now, so this second time should be quicker. |
This bit is OK though: Statements and scopingAny place a statement can be written, it can be replaced with a series of statements in boomerang scope start/end indicators < >. If a returned type is expected, the effective output of the statements should be the desired result. note: if it is simpler, we might just make all varibales in a given program global from the moment of creation? That would make the boomerangs just statement groupers rather than scopers, though. Just a thought. so, the
so
or identical in result to
|
additionI'm thinking x+y where one or more is a non-numeric type should be treating the + as punctuation rather than addition - so UNLIKE javascript, |
I think these work: Inputs
(Note: I have editited the initial thoughts entry above on types. They use to read, for example "to count things"; I've changed them to e.g. "that can count things"; the wording works better across more situations, including this one.) I've thought about this a lot, and I've made this compatible with the way paramaters are defined for functions, too... see Functions below. basic
gives an input cursor on screen for the user to type into. No particular prompt is displayed; it is up to the coder to have put something meaningful on the previous line. with prompt
As above, but the prompt will look like this:
typed
Only the relevant type of input (integer in this example) is allowed. For simplicity, I suggest we allow anything to be typed, and attempt to parse it. If parsing as the specified type fails, we can print typed with promptOf course, the two things demoed above can be combined:
Casting types
Casting a float to an int rounds it to the nearest integer. (not sure how viable this bit will be, but anyway) Functions and function callsInstructions on how to do named units of work are defined as the
examples:
That would be called by just typing the name of the function - Here's a function with input s of type 'that can measure stuff' (i.e. float) and a multi-line body:
Calling syntax with paramaters: e.g.
Idea: if the function is called with not all paramaters, prompt the user in a similar way as above with a 'by asking' clause of the paramater name if no prompt supplied??? Thus, if the code has Here's a function with two integer inputs and a float return value:
Call it like this:
|
ComparisonGreater than: |
ANDIf
Does that make sense? |
Something to consider, if Also, if you put a word after Also also, commas or whitespace? |
What I think the language needs
+-*/
(could be symbols, maybe some words like "is this bigger?", but aussie)The text was updated successfully, but these errors were encountered: