{"id":34272811,"url":"https://github.com/ghewgill/neon-lang","last_synced_at":"2026-03-11T20:01:21.248Z","repository":{"id":19522668,"uuid":"22769864","full_name":"ghewgill/neon-lang","owner":"ghewgill","description":"Implementation of a simple programming language","archived":false,"fork":false,"pushed_at":"2025-12-03T17:55:19.000Z","size":72213,"stargazers_count":72,"open_issues_count":24,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-12-20T08:35:32.084Z","etag":null,"topics":["neon","programming-language"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghewgill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.txt","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-08-08T19:59:17.000Z","updated_at":"2025-12-19T18:48:37.000Z","dependencies_parsed_at":"2025-12-17T01:05:17.527Z","dependency_job_id":null,"html_url":"https://github.com/ghewgill/neon-lang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ghewgill/neon-lang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghewgill%2Fneon-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghewgill%2Fneon-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghewgill%2Fneon-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghewgill%2Fneon-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghewgill","download_url":"https://codeload.github.com/ghewgill/neon-lang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghewgill%2Fneon-lang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30398156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T18:46:22.935Z","status":"ssl_error","status_checked_at":"2026-03-11T18:46:17.045Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neon","programming-language"],"created_at":"2025-12-16T20:02:14.269Z","updated_at":"2026-03-11T20:01:21.242Z","avatar_url":"https://github.com/ghewgill.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neon Language\n\nThe primary goal of Neon is to find out whether a useful programming language can avoid some of the common pitfalls that beginners frequently encounter in other languages. Some of these common errors avoided by design are:\n\n* Floating point errors due to binary floating point\n* Writing `if (x = 0)` when `if (x == 0)` is intended\n* Null pointer exceptions\n* Unintended empty loop with `while (condition);`\n* Forgetting to use the return value of a function\n\nThese errors have been identified through many years of participating on [Stack Overflow](https://stackoverflow.com), answering the same kinds of beginner questions over and over.\n\nSee [Common Errors](#common_errors) for a full list of similar common errors.\n\nThis implementation is also intended to demonstrate the following concepts of a compiler and runtime system:\n\n* Lexing\n* Parsing\n* Compilation\n* Linking\n* Bytecode verification\n* Execution\n* Debugging\n\n## Prerequisites\n\nTo build Neon, the following are required:\n\n- [Python 3.x](http://python.org)\n- [cmake](https://cmake.org)\n- A C++11 compiler (a modern `gcc`, `clang`, or Visual Studio 2013 or later)\n\nCurrent master branch build status:\n![Ubuntu](https://github.com/ghewgill/neon-lang/workflows/Ubuntu/badge.svg)\n![macOS](https://github.com/ghewgill/neon-lang/workflows/macOS/badge.svg)\n![Windows](https://github.com/ghewgill/neon-lang/workflows/Windows/badge.svg)\n[![Appveyor](https://ci.appveyor.com/api/projects/status/github/ghewgill/neon-lang?branch=master\u0026svg=true)](https://ci.appveyor.com/project/ghewgill/neon-lang)\n\n## Documentation\n\nSee [Neon Documentation](http://neon-lang.dev/docs/) for full documentation including:\n\n- [Tutorial](http://neon-lang.dev/docs/tutorial.html)\n- [Overview (for experienced programmers)](http://neon-lang.dev/docs/overview.html)\n- [Language Reference](http://neon-lang.dev/docs/reference/index.html)\n- [Standard Library](http://neon-lang.dev/docs/library.html)\n\n\u003ca name=\"common_errors\"\u003e\u003c/a\u003e\n## Common Errors\n\nThe following types of programming errors have been identified as frequently occurring among beginning programmers on Stack Overflow:\n\n* [Floating point errors due to binary floating point](#floating_point)\n* [Writing division expressions such as `5 / 2` and not expecting integer division](#integer_division)\n* [Writing `if (x = 0)` when `if (x == 0)` is intended](#assignment_equals)\n* [Null pointer exceptions](#null_pointer)\n* [Unintended empty loop with `while (condition);`](#empty_loop)\n* [Writing `if a == b or c` (in Python) to test whether `a` is equal to either `b` or `c`](#logical_alternative)\n* [Catching all exceptions](#catch_all)\n* [Accidentally shadowing outer scope variables with inner declaration](#shadow_variables)\n* [Returning a reference to a local variable (C++)](#return_reference)\n* [Partial reading of typed user input using Java `Scanner` or C `scanf('%c')`](#partial_input)\n* [Writing `^` to mean exponentiation in C or Java](#exponentiation_xor)\n* [Forgetting to use the return value of a function](#return_value)\n\n\u003ca name=\"floating_point\"\u003e\u003c/a\u003e\n### Floating point errors due to binary floating point\n\nMost languages use [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point) binary floating point for non-integer calculations.\nAlthough this is well-defined, it is often counterintuitive for beginners. Consider the following Python session:\n\n```python\n\u003e\u003e\u003e a = 0.1\n\u003e\u003e\u003e b = a + a + a\n\u003e\u003e\u003e b\n0.3\n\u003e\u003e\u003e b == 0.3\nFalse\n```\n\nThis happens because `0.3` cannot be repesented exactly in binary floating point.\n\nTo resolve this problem, Neon uses the [decimal128](https://en.wikipedia.org/wiki/Decimal128_floating-point_format) floating point type, which matches the base 10 that humans use to read and write numbers.\n\n\u003ca name=\"integer_division\"\u003e\u003c/a\u003e\n### Writing division expressions such as `5 / 2` and not expecting integer division\n\nConsider the following C statements:\n\n```c\nint a = 5;\nint b = 2;\ndouble c = a / b;\n```\n\nBeginners rightly assume that `c` will be `2.5` as the result of the division.\nHowever, the C language definition states that `/` will be *integer* division if both operands are integers.\nSo, the result in `c` is `2`.\n\nTo resolve this problem, the only number type in Neon is decimal128 floating point (called `Number`).\nIn contexts such as array indexing where integers are expected, values are checked for the presence of a fractional part before trying to use them.\n\n\u003ca name=\"assignment_equals\"\u003e\u003c/a\u003e\n### Writing `if (x = 0)` when `if (x == 0)` is intended\n\nIn C and derived languages, `x = 0` is an *expression* with the result 0.\nSome compilers raise a warning if an expression like `(x = 0)` is used in a conditional statement, as it is not likely to be what is intended.\nHowever, this is not prohibited by the language.\n\nTo resolve this problem, the assignment operator in Neon is `:=` and assignment cannot appear within an expression.\n\n\u003ca name=\"null_pointer\"\u003e\u003c/a\u003e\n### Null pointer exceptions\n\nIn many common systems languages (eg. C, C++, Java, C#), a pointer may hold a \"null\" value which is a runtime error to dereference. Tony Hoare has called the introduction of the null reference in ALGOL his [\"billion-dollar mistake\"](https://en.wikipedia.org/wiki/Tony_Hoare).\n\nTo resolve this problem, Neon introduces the idea of a \"valid\" pointer. A valid pointer is one that has been checked against `NIL` (the null reference) using a special form of the `IF` statement. The resulting valid pointer can be dereferenced without causing a null pointer exception.\n\n    TYPE Node IS RECORD\n        value: String\n    END RECORD\n\n    FUNCTION output(node: POINTER TO Node)\n        IF VALID node AS p THEN\n            print(p-\u003evalue)\n        END IF\n    END FUNCTION\n\n\u003ca name=\"empty_loop\"\u003e\u003c/a\u003e\n### Unintended empty loop with `while (condition);`\n\nIn C and derived languages, sometimes a loop or conditional is mistakenly written as:\n\n```c\nwhile (x \u003c 5);\n{\n    printf(\"%d\\n\", x);\n    x++;\n}\n```\n\nThe trailing `;` on the `while` statement is in fact an empty loop body and the loop is an infinite loop.\n\nTo resolve this problem, Neon requires an explicitly terminated block in every compound statement:\n\n    VAR x: Number := 0\n\n    WHILE x \u003c 5 DO\n        print(\"\\(x)\")\n        INC x\n    END WHILE\n\n\u003ca name=\"logical_alternative\"\u003e\u003c/a\u003e\n### Writing `if a == b or c` (in Python) to test whether `a` is equal to either `b` or `c`\n\nIn Python, beginners find it natural to write code like:\n\n```python\nif name == \"Jack\" or \"Jill\":\n    ...\n```\n\nThis is valid because the `\"Jill\"` is automatically treated as a boolean expression (with value `True`) and combined with the `name == \"Jack\"` condition using the `or` operator.\n\nTo resolve this problem, values in Neon cannot be automatically converted from one type to another (in particular, not to Boolean).\n\n\u003ca name=\"catch_all\"\u003e\u003c/a\u003e\n### Catching all exceptions\n\nLanguages with complex exception hierarchies (eg. C++, Java, C#, Python) allow the program to catch *all* types of exceptions using a construct such as `catch (...)` (C++) or `except:` (Python).\nThis generally has the unintended effect of masking exceptions that may not be among those expected by the programmer.\n\nNeon does not have an exception hierarchy, and the exception handling always uses explicitly named exceptions (there is no way to catch *all* types of exceptions).\n\n\u003ca name=\"shadow_variables\"\u003e\u003c/a\u003e\n### Accidentally shadowing outer scope variables with inner declaration\n\nMost programming languages allow names declared in a nested scope to *shadow* names declared in an enclosing scope (such as the global scope). For example, in C:\n\n```c\nint x;\n\nvoid f() {\n    int x;\n    x = 5;\n}\n```\n\nThis can lead to confusion due to unexpectedly using the wrong variable.\n\nIn Neon, it is an error for a declaration to shadow an outer declaration.\n\n\u003ca name=\"return_reference\"\u003e\u003c/a\u003e\n### Returning a reference to a local variable (C++)\n\nIn C++, it is possible to return a reference (or pointer) to a local variable:\n\n```c++\nint \u0026foo(int x) {\n    int a = x * x;\n    return a;\n}\n```\n\nThis is *undefined behaviour* because the reference returns to memory that has been deallocated as soon as the function returns.\n\nThis is resolved in Neon by not having references.\n\n\u003ca name=\"partial_input\"\u003e\u003c/a\u003e\n### Partial reading of typed user input using Java `Scanner` or C `scanf('%c')`\n\nThe Java `Scanner` class and C `scanf` functions treat their input as a stream.\nHowever, when used with interactive terminal input, they do not return a value until an *entire* line has been typed at the console.\nThis causes confusion when the user types more than what is expected and the remainder of what the user typed is held in the input buffer until the next time input is requested.\nAt that time, the contents of the buffer are used without waiting for user input.\n\nThis is resolved in Neon by only providing line oriented input for text.\n\n\u003ca name=\"exponentiation_xor\"\u003e\u003c/a\u003e\n### Writing `^` to mean exponentiation in C or Java\n\nSometimes beginners expect the `^` operator to mean exponentiation (eg. `dist = sqrt(a^2 + b^2)`).\nHowever, `^` means bitwise XOR in many languages, which is not expected.\n\nIn Neon, `^` means exponentiation.\n\n\u003ca name=\"#return_value\"\u003e\u003c/a\u003e\n### Forgetting to use the return value of a function\n\nMany programming languages permit a function that returns a value to be called without actually using the return value.\nThis is a frequent source of bugs because the return value may indicate an error condition, which is then ignored.\n\nIn Neon, it is an error to call a function that returns a value without using that value in some way.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghewgill%2Fneon-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghewgill%2Fneon-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghewgill%2Fneon-lang/lists"}