Dialects: add basison (BASIC) and rubascal (Pascal/Ruby) - #6254
Open
runarorama wants to merge 2 commits into
Open
Dialects: add basison (BASIC) and rubascal (Pascal/Ruby)#6254runarorama wants to merge 2 commits into
runarorama wants to merge 2 commits into
Conversation
Two more surface syntaxes over the same content-addressed AST, both round-tripping through the Surface IR like the existing alt dialects: - basison: BASIC-flavored. FUNCTION name(p, …) … RETURN e END FUNCTION, SELECT CASE … END SELECT, IF c THEN t ELSE e END IF, LET bindings, AS for type ascription, UPPERCASE keywords, ':' statement separator. The full type rides on a preceding 'name AS Type' signature line. - rubascal: a Pascal/Ruby hybrid. def name(p, …) … end with an implicit return (last expression is the result), case … when p then body … end, if c then t else e end, ':=' value bindings (Pascal), ':' type ascription, begin … end blocks, '->()' lambdas, ';' separators, bare 'end' enders. Both are registered in Unison.Syntax.Dialect and selectable with 'syntax.set basison' / 'syntax.set rubascal'. The dialects transcript gains a demo section for each.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of #6253 (base branch:
pluggable-syntax-dialects).Two more surface syntaxes over the same content-addressed AST — added "for shits and giggles" — both round-tripping through the
SurfaceIR like the existing alt dialects:basison— BASIC-flavoredFUNCTION name(p, …) … RETURN e END FUNCTION,SELECT CASE … END SELECT,IF c THEN t ELSE e END IF,LETbindings,ASfor type ascription, UPPERCASE keywords,:statement separator. The full type rides on a precedingname AS Typesignature line.rubascal— a Pascal/Ruby hybriddef name(p, …) … endwith an implicit return (the last expression is the result, Ruby-style),case … when p then body … end,if c then t else e end,:=value bindings (Pascal),:type ascription,begin … endblocks,->()lambdas,;separators, bareendenders.Both are registered in
Unison.Syntax.Dialectand selectable withsyntax.set basison/syntax.set rubascal. The dialects transcript gains a demo section for each, andview/editround-trip to identical hashes (verified on functions, recursion, tuples, pattern matching, documented definitions, and typed local helpers).