-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,399 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'about' | 'above' | 'across' | 'after' | 'against' | 'all' | 'alone' | 'along' | 'among' | 'any' | 'anywhere' | 'around' | 'as' | 'at' | 'away' | 'back' | 'backward' | 'backwards' | 'before' | 'beginning' | 'behind' | 'below' | 'beneath' | 'beside' | 'between' | 'beyond' | 'bigger' | 'by' | 'close' | 'deep' | 'diagonally' | 'down' | 'downward' | 'ending' | 'everywhere' | 'except' | 'finishing' | 'facing' | 'for' | 'forward' | 'from' | 'given' | 'giving' | 'high' | 'in' | 'inside' | 'into' | 'larger' | 'leaning' | 'left' | 'leftward' | 'leftways' | 'like' | 'limiting' | 'long' | 'near' | 'of' | 'off' | 'on' | 'only' | 'onto' | 'out' | 'outside' | 'over' | 'past' | 'pointing' | 'returning' | 'right' | 'rightward' | 'rightways' | 'shorter' | 'sideway' | 'sideways' | 'similar' | 'smaller' | 'somewhere' | 'slantwise' | 'slantway' | 'slantways' | 'starting' | 'tall' | 'taller' | 'thru' | 'through' | 'throughout' | 'to' | 'toward' | 'towards' | 'under' | 'underneath' | 'until' | 'unto' | 'up' | 'upward' | 'upon' | 'using' | 'via' | 'while' | 'wide' | 'with' | 'within' | 'without' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
This is the EBNF. It has some terms that are not defined anywhere so you will have to create some new rules for them (like "non-possessive" or "non-glombyte"). Assume extended ASCII as Windows 1252 codepage. Assume chars as any printable character from Windows 1252 codepage. Also, where there is some rule with -name in its end (like type-name or routine-name) treat this terms like any possible word. Any word in uppercase is a string literal, like TARGET, MAGNITUDE or WHEREABOUTS | ||
Articles are "a", "an" and "the. | ||
Prepositions are "about", "above", "across", "after", "against", "all", "alone", "along", "among", "any", "anywhere", "around", "as", "at", "away", "back", "backward", "backwards", "before", "beginning", "behind", "below", "beneath", "beside", "between", "beyond", "bigger", "by", "close", "deep", "diagonally", "down", "downward", "ending", "everywhere", "except", "finishing", "facing", "for", "forward", "from", "given", "giving", "high", "in", "inside", "into", "larger", "leaning", "left", "leftward", "leftways", "like", "limiting", "long", "near", "of", "off", "on", "only", "onto", "out", "outside", "over", "past", "pointing", "returning", "right", "rightward", "rightways", "shorter", "sideway", "sideways", "similar", "smaller", "somewhere", "slantwise", "slantway", "slantways", "starting", "tall", "taller", "thru", "through", "throughout", "to", "toward", "towards", "under", "underneath", "until", "unto", "up", "upward", "upon", "using", "via", "while", "wide", "with", "within", "without" | ||
Conjunctions are 'and' , 'both' , 'but' , 'either' , 'neither' , 'nor' and 'or' | ||
|
||
|
||
The TypeName, VariableName, FieldName, DllName, EntryName, ParameterTerm are all words. They may contain any printable character from Windows 1252 codepage. their size may vary from 1 to undefinite size. | ||
|
||
|
||
--- LEXICAL BNF --- | ||
|
||
noise = non-printable | space | tab | non-breaking-space | ||
comment = \ chars cr | ||
remark = [ printable-chars ] | ||
|
||
token = glom | possessive | qualifier | string | ||
|
||
glom = glomstarter { glombyte } | ||
glombyte = letter | digit | ~ @ # % _ $ & - + / | non-possessive ' | ||
glomstarter = letter | digit | ~ @ # % _ $ & ' | ||
letter = A..Z | a..z | extended ascii | ||
digit = 0..9 | ||
|
||
possessive = ' preceded by S followed by non-glombyte | 'S non-glombyte | ||
qualifier = ( printable-chars ) | ||
string = " printable-chars | nested-quotes " | ||
|
||
mark = . , ; : ! ? | ||
symbol = | * + - ^ / < > { } = extended ascii | ||
|
||
--- ONE LEVEL UP FROM LEXICAL --- | ||
|
||
noise = lexical-noise | comment | remark | ||
integer-token = digit { digit } | ||
ratio-token = integer-token / integer-token | ||
mixed-token = integer-token - integer-token / integer-token | ||
numeric-token = integer-token | ratio-token | mixed-token | ||
nibble-token = $ { digit | A..F } | ||
string-token = same as lexical | ||
qualifier-token = same as lexical | ||
|
||
--- SYNTATICAL BNF --- | ||
|
||
program = { type | global | routine } | ||
|
||
built-in-types = BYTE | BYTE POINTER | WYRD | NUMBER | FLAG | POINTER | RECORD | STRING | SUBSTRING | HEX-STRING | ||
| THING | THING RECORD | THINGS | RATIO | NUMERATOR | DENOMINATOR | ||
|
||
type = A name IS A type-name [ optional-info ] . | ||
= A name HAS fields . | ||
= A name IS number-token type-name . | ||
|
||
optional-info = TO A type-name | WITH fields | ||
|
||
fields = field-descriptor { pauses field-descriptor } | ||
field-descriptor = ( A name | numeric-token BYTES ) { CALLED name | AT THE name | ( REFERENCE ) } | ||
|
||
pause = , | ; | AND | OR | ||
pauses = { pause } | ||
|
||
conjunction = AND | BOTH | BUT | EITHER | NEITHER | NOR | OR | ||
preposition = IN | OF | ON | WITH | BEFORE | AFTER ... | ||
|
||
global = THE name IS A type-name [ optional-info ] . | ||
= THE name HAS fields . | ||
= THE name IS A type-name EQUAL TO constant-term . | ||
= THE name IS constant-term . | ||
|
||
routine = procedure | decider | function | callback | ||
procedure = { TO routine-name ; } | TO routine-name : employ-clause | statements | ||
decider = { TO DECIDE IF routine-name ; } | TO DECIDE IF routine-name : employ-clause | statements | ||
function = { TO PUT A type-name 'S name INTO A type-name ; } | TO PUT A type-name 'S name INTO A type-name : employ-clause | statements | ||
= { TO PUT THE name 'S name INTO A type-name ; } | TO PUT THE name 'S name INTO A type-name : employ-clause | statements | ||
callback = { TO COMPATIBLY routine-name ; } TO COMPATIBLY routine-name : employ-clause | statements | ||
|
||
routine-name = { monikette | parameter | phrase } [ qualifier ] | ||
monikette = any word except articles | ||
parameter = A name [ CALLED name ] | ||
phrase = THE name | ||
employ-clause = EMPLOY routine-name . | ||
|
||
name = { any word except articles, prepositions, conjunctions, verbs, operators, CALLED, EQUAL } | ||
|
||
statement = privatize | loop | conditional | unconditional . | ||
privatize = PRIVATIZE parameter-term . | ||
loop = LOOP . | ||
conditional = IF decider-call , unconditional { ; unconditional } . | ||
|
||
unconditional = break | call | exit | intel | repeat | point | push | say | ||
break = BREAK | ||
call (internal) = { monikette | expression | phrase } [ qualifier ] | ||
call (external) = CALL "dll-name" "entry-name" [ WITH expression { AND expression } ] [ RETURNING term ] | ||
call (indirect) = CALL expression [ WITH expression { AND expression } ] [ RETURNING term ] | ||
exit = EXIT | ||
intel = INTEL nibble-token | ||
point = POINT term TO ROUTINE { monikette | parameter | phrase } [ qualifier ] | ||
push = PUSH expression | ||
repeat = REPEAT | ||
say = SAY flag-expression | ||
|
||
expression = term { operator term } | ||
operator = PLUS | MINUS | TIMES | DIVIDED BY | THEN | ||
|
||
constant-term = negated-constant-term | posigated-constant-term | literal | ||
negated-constant-term = - constant-term | ||
posigated-constant-term = + constant-term | ||
literal = numeric-token [ type name ] | string-token | nibble-token | YES | NO | NIL | ||
|
||
term = negated-term | posigated-term | new-local | variable | literal-term [ AS A type-name ] [ / term ] | ||
negated-term = - term | ||
posigated-term = + term | ||
new-local = A name [ CALLED name ] possessives | ||
variable = THE variable-name possessives | ||
literal-term = literal possessives | ||
|
||
possessives = { possessives } | ||
possesive = 'S ( field-name | function | TARGET | MAGNITUDE | WHEREABOUTS ) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
"Name" = "My Language" | ||
|
||
! Predefined character sets | ||
{Letter} = [&41 .. &5A] | [&61 .. &7A] | ||
{Digit} = [&30 .. &39] | ||
{Printable} = [&20 .. &7E] | [&A0] | ||
{NonPrintable} = [&00 .. &1F] | [&7F .. &9F] | ||
|
||
! Additional character sets | ||
{Space} = [&20] | ||
{Tab} = [&09] | ||
{NonBreakingSpace} = [&A0] | ||
{ExtendedASCII} = [&A1 .. &FF] | ||
{Symbol} = [ | * + - ^ / < > { } =] | {ExtendedASCII} | ||
{Mark} = [. , ; : ! ?] | ||
|
||
! Composite character sets | ||
{GlomStarter} = {Letter} | {Digit} | ~ @ # % _ $ & ' | ||
{GlomByte} = {Letter} | {Digit} | ~ @ # % _ $ & - + / | ' | ||
{NonGlomByte} = {Printable} - {GlomByte} | ||
|
||
! Tokens | ||
Noise = {NonPrintable} | {Space} | {Tab} | {NonBreakingSpace} | ||
Comment = \ {Printable} {CR} | ||
Remark = [{Printable}] | ||
Token = Glom | Possessive | Qualifier | String | ||
|
||
! Gloms | ||
Glom = {GlomStarter} {GlomByte} | ||
GlomStarter = {GlomStarter} | ||
GlomByte = {GlomByte} | ||
Letter = {Letter} | {ExtendedASCII} | ||
Digit = {Digit} | ||
|
||
! Possessives | ||
Possessive = 'S {NonGlomByte} | ' {NonGlomByte} | ||
|
||
! Qualifiers | ||
Qualifier = ({Printable}) | ||
|
||
! Strings | ||
String = "{Printable}" | "{String}" | ||
String = """{Printable}""" | ||
NestedQuotes = """{Printable}""" | """" | ||
|
||
! Symbols | ||
Mark = {Mark} | ||
Symbol = {Symbol} | ||
|
||
! ONE LEVEL UP | ||
Noise = Noise | Comment | Remark | ||
IntegerToken = {Digit} {Digit}* | ||
RatioToken = {IntegerToken} / {IntegerToken} | ||
MixedToken = {IntegerToken} - {IntegerToken} / {IntegerToken} | ||
NumericToken = {IntegerToken} | {RatioToken} | {MixedToken} | ||
NibbleToken = $ {Digit}|{Letter}[A..F] | ||
StringToken = String | ||
QualifierToken = Qualifier | ||
|
||
! SYNTACTICAL BNF | ||
|
||
Program = {Type | Global | Routine} | ||
|
||
! Built-in Types | ||
BuiltInTypes = BYTE | BYTE POINTER | WYRD | NUMBER | FLAG | POINTER | RECORD | STRING | SUBSTRING | HEX-STRING | ||
| THING | THING RECORD | THINGS | RATIO | NUMERATOR | DENOMINATOR | ||
|
||
! Type Definitions | ||
Type = A {Name} IS A {TypeName} [{OptionalInfo}] . | ||
| A {Name} HAS {Fields} . | ||
| A {Name} IS {NumericToken} {TypeName} . | ||
|
||
OptionalInfo = TO A {TypeName} | WITH {Fields} | ||
|
||
! Fields | ||
Fields = {FieldDescriptor} {Pause} {FieldDescriptor} | ||
FieldDescriptor = (A {Name} | {NumericToken} BYTES) {CALLED {Name} | AT THE {Name} | (REFERENCE)} | ||
|
||
! Pauses | ||
Pause = , | ; | AND | OR | ||
Pauses = {Pause} | ||
|
||
! Conjunctions | ||
Conjunction = AND | BOTH | BUT | EITHER | NEITHER | NOR | OR | ||
|
||
! Prepositions | ||
Preposition = IN | OF | ON | WITH | BEFORE | AFTER | ... | ||
|
||
! Globals | ||
Global = THE {Name} IS A {TypeName} [{OptionalInfo}] . | ||
| THE {Name} HAS {Fields} . | ||
| THE {Name} IS A {TypeName} EQUAL TO {ConstantTerm} . | ||
| THE {Name} IS {ConstantTerm} . | ||
|
||
! Routines | ||
Routine = Procedure | Decider | Function | Callback | ||
Procedure = {TO {RoutineName} ;} | TO {RoutineName} : {EmployClause} | {Statements} | ||
Decider = {TO DECIDE IF {RoutineName} ;} | TO DECIDE IF {RoutineName} : {EmployClause} | {Statements} | ||
Function = {TO PUT A {TypeName} 'S {Name} INTO A {TypeName} ;} | TO PUT A {TypeName} 'S {Name} INTO A {TypeName} : {EmployClause} | {Statements} | ||
| {TO PUT THE {Name} 'S {Name} INTO A {TypeName} ;} | TO PUT THE {Name} 'S {Name} INTO A {TypeName} : {EmployClause} | {Statements} | ||
Callback = {TO COMPATIBLY {RoutineName} ;} TO COMPATIBLY {RoutineName} : {EmployClause} | {Statements} | ||
|
||
! Routine Names | ||
RoutineName = {Monikette | Parameter | Phrase} [{Qualifier}] | ||
Monikette = {AnyWordExceptArticles} | ||
Parameter = A {Name} [CALLED {Name}] | ||
Phrase = THE {Name} | ||
EmployClause = EMPLOY {RoutineName} . | ||
|
||
! Names | ||
Name = {AnyWordExceptArticles, Prepositions, Conjunctions, Verbs, Operators, CALLED, EQUAL} | ||
|
||
! Statements | ||
Statement = Privatize | Loop | Conditional | Unconditional . | ||
Privatize = PRIVATIZE {ParameterTerm} . | ||
Loop = LOOP . | ||
Conditional = IF {DeciderCall} , {Unconditional} { ; {Unconditional} } . | ||
|
||
! Unconditional Statements | ||
Unconditional = Break | Call | Exit | Intel | Repeat | Point | Push | Say | ||
Break = BREAK | ||
Call(internal) = {Monikette | Expression | Phrase} [{Qualifier}] | ||
Call(external) = CALL "{DllName}" "{EntryName}" [WITH {Expression} {AND {Expression}}] [RETURNING {Term}] | ||
Call(indirect) = CALL {Expression} [WITH {Expression} {AND {Expression}}] [RETURNING {Term}] | ||
Exit = EXIT | ||
Intel = INTEL {NibbleToken} | ||
Point = POINT {Term} TO ROUTINE {Monikette | Parameter | Phrase} [{Qualifier}] | ||
Push = PUSH {Expression} | ||
Repeat = REPEAT | ||
Say = SAY {FlagExpression} | ||
|
||
! Expressions | ||
Expression = {Term} {Operator} {Term} | ||
Operator = PLUS | MINUS | TIMES | DIVIDED BY | THEN | ||
|
||
! Constant Terms | ||
ConstantTerm = NegatedConstantTerm | Posi gatedConstantTerm | Literal | ||
NegatedConstantTerm = - {ConstantTerm} | ||
Posi gatedConstantTerm = + {ConstantTerm} | ||
Literal = {NumericToken} [{TypeName}] | {StringToken} | {NibbleToken} | YES | NO | NIL | ||
|
||
! Terms | ||
Term = NegatedTerm | Posi gatedTerm | NewLocal | Variable | LiteralTerm [{AsATypeName}] [{/ {Term}}] | ||
NegatedTerm = - {Term} | ||
Posi gatedTerm = + {Term} | ||
NewLocal = A {Name} [CALLED {Name}] {Possessives} | ||
Variable = THE {VariableName} {Possessives} | ||
LiteralTerm = {Literal} {Possessives} | ||
|
||
! Possessives | ||
Possessives = {Possessive} | ||
Possessive = 'S ({FieldName} | {Function} | TARGET | MAGNITUDE | WHEREABOUTS) | ||
|
||
! Additional Rules (assuming extended ASCII) | ||
AnyWordExceptArticles = {Letter}{Letter}* | ||
TypeName = {AnyWordExceptArticles} | ||
VariableName = {AnyWordExceptArticles} | ||
FieldName = {AnyWordExceptArticles} | ||
Function = {AnyWordExceptArticles} | ||
DllName = {AnyWordExceptArticles} | ||
EntryName = {AnyWordExceptArticles} | ||
|
||
! Other missing rules (make assumptions based on the context) | ||
ParameterTerm = {AnyWordExceptArticles} | ||
DeciderCall = {AnyWordExceptArticles} | ||
FlagExpression = {AnyWordExceptArticles} | ||
|
||
! You might need to add more rules and refine existing ones based on | ||
! the specific requirements of your language. |
Oops, something went wrong.