From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail-a.sr.ht; dkim=pass header.d=johnnyrichard.com header.i=@johnnyrichard.com Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) by mail-a.sr.ht (Postfix) with ESMTPS id EAF592032B for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 28 Feb 2024 18:10:14 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1709143814; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gne8YTRFhBUpCsffcy2sOE0VR+i4157yC5ekkzLmi2o=; b=f2+d2gJjQH01RUGZxtHG8jA+aUk7FQtBGXrBL86jwjpIgt5PNkZ8DjjnUmCVB4q7dZQECV SQo3KAH3vy2WWWlClwK2fbTOWGk0UlXRLfrtWwMP9GzXGhHa9dKhn/xXDIMuAkAbtWWzbx UCmyRjtt9rPKQbJGod1txEyFNKuMlcUFlgh67FfQiw9pQDJd6IOq4wNQeY9UhKuRhpjtjE e3FE3aCUuMk9obEhyvJqoI7Y7mosn6PPi+Kh+Imt2/21Mn7qyfjYr+Gi3aGplyak56HqXo Dm5RYJmTOfOZm0fpWyus5Phj8WIztukxXmhe8vMnQfj9xlh74cvdqqb0Lwm5YA== From: Johnny Richard To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Johnny Richard Subject: [PATCH olang v1 0/4] create initial syntax analysis logic Date: Wed, 28 Feb 2024 20:04:17 +0100 Message-ID: <20240228190956.78191-1-johnny@johnnyrichard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-TUID: ti+iFDVPADv3 This patchset implements the initial syntax analysis logic for a small portion of the language. Since the type system contains only a u32 type, the semantic analysis can be postponed. In terms of Abstract Syntax Tree, this patchset also introduces a very basic AST data structure. Johnny Richard (4): string_view: add string view formatter for printf fmt string_view: add string view conversion to uint32_t lexer: add token lookahead capability parser: create simplified parser for tiny AST src/ast.c | 79 ++++++++++++++ src/ast.h | 101 ++++++++++++++++++ src/lexer.c | 38 +++++++ src/lexer.h | 10 ++ src/parser.c | 193 ++++++++++++++++++++++++++++++++++ src/parser.h | 38 +++++++ src/string_view.c | 11 ++ src/string_view.h | 8 +- tests/unit/parser_test.c | 88 ++++++++++++++++ tests/unit/string_view_test.c | 61 +++++++++++ 10 files changed, 626 insertions(+), 1 deletion(-) create mode 100644 src/ast.c create mode 100644 src/ast.h create mode 100644 src/parser.c create mode 100644 src/parser.h create mode 100644 tests/unit/parser_test.c create mode 100644 tests/unit/string_view_test.c -- 2.43.2